Clang: Add timer based path notification compression

QFileWatcher is only reporting one path per signal which is suboptimal if
you change many files at once. This patch is introducing a timer which is
waiting some time time to see if more path changes are reported and is
collecting them in a vector.

Change-Id: I50f7c21186353b199634e7b3cd5a41f8d581a31d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2017-01-31 11:14:54 +01:00
parent 9678c09355
commit 2c55a9c569
12 changed files with 426 additions and 51 deletions

View File

@@ -37,6 +37,7 @@
#include <QFileSystemWatcher>
#include <QLoggingCategory>
#include <QTemporaryDir>
#include <QTimer>
using ClangBackEnd::ClangPathWatcher;
using ClangBackEnd::ConnectionServer;
@@ -93,11 +94,15 @@ int main(int argc, char *argv[])
const QString connection = processArguments(application);
StringCache<Utils::SmallString> filePathCache;
ClangPathWatcher<QFileSystemWatcher> includeWatcher(filePathCache);
ClangPathWatcher<QFileSystemWatcher, QTimer> includeWatcher(filePathCache);
ApplicationEnvironment environment;
PchCreator pchCreator(environment, filePathCache);
ProjectParts projectParts;
PchManagerServer clangPchManagerServer(filePathCache, includeWatcher, pchCreator, projectParts);
PchManagerServer clangPchManagerServer(filePathCache,
includeWatcher,
pchCreator,
projectParts);
includeWatcher.setNotifier(&clangPchManagerServer);
ConnectionServer<PchManagerServer, PchManagerClientProxy> connectionServer(connection);
connectionServer.start();
connectionServer.setServer(&clangPchManagerServer);