Clang: Add progress bars for creating PCHs and indexing

Task-number: QTCREATORBUG-21112
Change-Id: Ie0c00a58f479a2fe7cbc7322490808509733ff0f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-09-27 17:52:44 +02:00
parent ffc070a3f2
commit 391cfab5d7
60 changed files with 865 additions and 49 deletions

View File

@@ -29,6 +29,7 @@
#include "symbolindexertask.h"
#include <filepathid.h>
#include <progresscounter.h>
#include <taskschedulerinterface.h>
#include <utils/algorithm.h>
@@ -51,8 +52,10 @@ class SymbolIndexerTaskQueue final : public SymbolIndexerTaskQueueInterface
public:
using Task = SymbolIndexerTask::Callable;
SymbolIndexerTaskQueue(TaskSchedulerInterface<Task> &symbolIndexerTaskScheduler)
: m_symbolIndexerScheduler(symbolIndexerTaskScheduler)
SymbolIndexerTaskQueue(TaskSchedulerInterface<Task> &symbolIndexerTaskScheduler,
ProgressCounter &progressCounter)
: m_symbolIndexerScheduler(symbolIndexerTaskScheduler),
m_progressCounter(progressCounter)
{}
void addOrUpdateTasks(std::vector<SymbolIndexerTask> &&tasks)
@@ -63,7 +66,11 @@ public:
return std::move(first);
};
const std::size_t oldSize = m_tasks.size();
m_tasks = Utils::setUnionMerge<std::vector<SymbolIndexerTask>>(tasks, m_tasks, merge);
m_progressCounter.addTotal(int(m_tasks.size() - oldSize));
}
void removeTasks(const std::vector<int> &projectPartIds)
{
@@ -71,9 +78,13 @@ public:
return std::binary_search(projectPartIds.begin(), projectPartIds.end(), task.projectPartId);
};
const std::size_t oldSize = m_tasks.size();
auto newEnd = std::remove_if(m_tasks.begin(), m_tasks.end(), shouldBeRemoved);
m_tasks.erase(newEnd, m_tasks.end());
m_progressCounter.removeTotal(int(oldSize -m_tasks.size()));
}
const std::vector<SymbolIndexerTask> &tasks() const
@@ -96,6 +107,7 @@ private:
std::vector<Utils::SmallString> m_projectPartIds;
std::vector<SymbolIndexerTask> m_tasks;
TaskSchedulerInterface<Task> &m_symbolIndexerScheduler;
ProgressCounter &m_progressCounter;
};
} // namespace ClangBackEnd