TaskTree: Introduce CallDoneIf enum

Get rid of CustomTask c'tor taking 3 handlers.
If the done handler needs to be called only on
success or an error, add explicit 3rd arg of CallDoneIf type.

Task-number: QTCREATORBUG-29834
Change-Id: I10e55415587e6cac46620dd5177ad8269584583c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2023-11-02 18:47:38 +01:00
parent 63bfeba87f
commit 6e6aa7102c
29 changed files with 148 additions and 127 deletions

View File

@@ -377,7 +377,7 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
qCDebug(LOG) << "Using" << limit << "threads for scan.";
QList<GroupItem> tasks{parallelLimit(limit)};
for (const FilePath &file : filteredFiles) {
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
const auto onSetup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
async.setPriority(QThread::LowestPriority);
async.setFutureSynchronizer(&m_futureSynchronizer);
@@ -387,7 +387,7 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
for (const TestParseResultPtr &result : results)
emit testParseResultReady(result);
};
tasks.append(AsyncTask<TestParseResultPtr>(setup, onDone));
tasks.append(AsyncTask<TestParseResultPtr>(onSetup, onDone, CallDoneIf::Success));
}
m_taskTree.reset(new TaskTree{tasks});
const auto onDone = [this] { m_taskTree.release()->deleteLater(); onFinished(true); };