QmlJS: Track futures to allow testing

Tests often want to wait for all async tasks to finish before
progressing.

Change-Id: I61738df730ca341b5c9d227569d961cd1991b296
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Philip Van Hoof <philip@codeminded.be>
This commit is contained in:
Christian Kamm
2020-05-10 16:00:31 +02:00
parent 037ff590e6
commit 96c860159b
4 changed files with 48 additions and 14 deletions

View File

@@ -179,8 +179,9 @@ public:
virtual ProjectInfo defaultProjectInfoForProject(ProjectExplorer::Project *project) const;
// Blocks until all parsing threads are done. Used for testing.
void joinAllThreads();
// Blocks until all parsing threads are done. Use for testing only!
void test_joinAllThreads();
void addFuture(const QFuture<void> &future);
QmlJS::Document::Ptr ensuredGetDocumentForPath(const QString &filePath);
static void importScan(QFutureInterface<void> &future, const WorkingCopy& workingCopyInternal,
@@ -271,7 +272,9 @@ private:
PluginDumper *m_pluginDumper = nullptr;
mutable QMutex m_futuresMutex;
QList<QFuture<void>> m_futures;
bool m_indexerDisabled = false;
};