aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2017-02-06 16:59:53 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2017-02-20 09:18:13 +0000
commit8c90998fff6ec3cf85ad87b56175e86b6f0a93d0 (patch)
treec3f838d24e4cd7c3484c5a50d1f07a5b73de5bf9 /src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
parent010060de5c205a79dba0343ef82f10f3446c1e58 (diff)
CppTools/ProjectManagers: Reduce ui blocking when loading projects
${AnyProject}::updateCppCodeModel() did two potentially not that cheap operations in the ui thread: (1) Querying the MimeDatabase for the mime type for the source files of the project. In 99.9% of the cases no files need to be read for this as the file extension will resolve the type. The expensiveness comes from the sheer number of files that can occur. (2) Calling compilers with the "(sub)project's compiler command line" to determine the macros. While the caches avoid redundant calls, the number of the unique compiler calls makes this still a ui-freezing experience. These two operations are moved into a worker thread. For this, the expensive compiler calls are encapsulated in thread safe lambdas ("runners") in order to keep the "mutexed" data minimal. The original API calls of the toolchains are implemented in terms of the runners. While adapting the project managers, remove also the calls to setProjectLanguage(). These are redundant because all of the project managers already set a proper value in the constructor. Also, currently there is no need (client) to report back detection of C sources in project parts. This also keeps CppProjectUpdater simple. There is still room for improvement: * Run the compiler calls in parallel instead of sequence. * Ensure that the mime type for a file is determined exactly once. Change-Id: I2efc4e132ee88e3c8f264012ec8fafe3d86c404f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
index ce561412b1..1afd9c33d7 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
@@ -29,12 +29,13 @@
#include "cmakeproject.h"
#include "configmodel.h"
+#include <cpptools/cpprawprojectpart.h>
+
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/abi.h>
#include <memory>
-namespace CppTools { class ProjectPartBuilder; }
namespace ProjectExplorer { class ToolChain; }
namespace CMakeProjectManager {
@@ -86,7 +87,7 @@ public:
QList<CMakeBuildTarget> buildTargets() const;
void generateProjectTree(CMakeListsNode *root, const QList<const ProjectExplorer::FileNode *> &allFiles) const;
- QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder);
+ void updateCodeModel(CppTools::RawProjectParts &rpps);
static Utils::FileName
shadowBuildDirectory(const Utils::FileName &projectFilePath, const ProjectExplorer::Kit *k,