src: avoid indexing slowdown on macOS by not using unknown progress for progressbar in status bar

This commit is contained in:
Eberhard Graether
2018-07-24 03:36:27 +02:00
parent 0fc670bcd7
commit ac31bb6779
14 changed files with 34 additions and 67 deletions
@@ -43,7 +43,7 @@ void StatusBarController::handleMessage(MessageIndexingStatus* message)
{
if (message->showProgress)
{
getView()->showIndexingProgress(message->unknownProgress, message->progressPercent);
getView()->showIndexingProgress(message->progressPercent);
}
else
{
-5
View File
@@ -16,11 +16,6 @@ void DialogView::setDialogsHideable(bool hideable)
m_dialogsHideable = hideable;
}
void DialogView::setUpdateIndexingStatus(bool updateStatus)
{
m_updateIndexingStatus = updateStatus;
}
bool DialogView::dialogsHidden() const
{
return false;
-2
View File
@@ -34,7 +34,6 @@ public:
UseCase getUseCase() const;
void setDialogsHideable(bool hideable);
void setUpdateIndexingStatus(bool updateStatus);
virtual bool dialogsHidden() const;
virtual void clearDialogs();
@@ -64,7 +63,6 @@ protected:
StorageAccess* m_storageAccess;
bool m_dialogsHideable = false;
bool m_updateIndexingStatus = false;
};
#endif // DIALOG_VIEW_H
+1 -1
View File
@@ -19,7 +19,7 @@ public:
virtual void showIdeStatus(const std::wstring& message) = 0;
virtual void showIndexingProgress(bool unknownProgress, size_t progressPercent) = 0;
virtual void showIndexingProgress(size_t progressPercent) = 0;
virtual void hideIndexingProgress() = 0;
protected:
+3
View File
@@ -3,6 +3,7 @@
#include "component/view/DialogView.h"
#include "data/storage/PersistentStorage.h"
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
#include "utility/messaging/type/indexing/MessageIndexingStatus.h"
#include "utility/messaging/type/MessageQuitApplication.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/scheduling/Blackboard.h"
@@ -91,6 +92,8 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
interruptedIndexing
);
MessageIndexingStatus(false).dispatch();
{
std::lock_guard<std::mutex> lock(blackboard->getMutex());
+8
View File
@@ -2,6 +2,7 @@
#include "utility/AppPath.h"
#include "utility/logging/FileLogger.h"
#include "utility/messaging/type/indexing/MessageIndexingStatus.h"
#include "utility/scheduling/Blackboard.h"
#include "utility/UserPaths.h"
#include "utility/utilityApp.h"
@@ -298,4 +299,11 @@ void TaskBuildIndex::updateIndexingDialog(
Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING)->updateIndexingDialog(
m_indexingFileCount, indexedSourceFileCount, sourceFileCount, sourcePaths);
int progress = 0;
if (sourceFileCount)
{
progress = indexedSourceFileCount * 100 / sourceFileCount;
}
MessageIndexingStatus(true, progress).dispatch();
}
+3
View File
@@ -2,6 +2,7 @@
#include "component/view/DialogView.h"
#include "data/storage/PersistentStorage.h"
#include "utility/messaging/type/indexing/MessageIndexingStatus.h"
#include "utility/scheduling/Blackboard.h"
#include "utility/utility.h"
#include "Application.h"
@@ -20,6 +21,8 @@ void TaskParseWrapper::doEnter(std::shared_ptr<Blackboard> blackboard)
{
dialogView->clearDialogs();
dialogView->updateIndexingDialog(0, 0, sourceFileCount, { });
MessageIndexingStatus(true, 0).dispatch();
}
m_start = utility::durationStart();
+2 -2
View File
@@ -24,6 +24,7 @@
#include "utility/messaging/type/error/MessageErrorCountClear.h"
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
#include "utility/messaging/type/indexing/MessageIndexingStarted.h"
#include "utility/messaging/type/indexing/MessageIndexingStatus.h"
#include "utility/messaging/type/MessageRefresh.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/scheduling/TaskDecoratorRepeat.h"
@@ -398,6 +399,7 @@ void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> di
MessageErrorCountClear().dispatch();
dialogView->showUnknownProgressDialog(L"Preparing Indexing", L"Setting up Indexers");
MessageIndexingStatus(true, 0).dispatch();
m_storageCache->clear();
m_storageCache->setSubject(m_storage.get());
@@ -417,7 +419,6 @@ void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> di
bool hideable = m_state == PROJECT_STATE_LOADED || m_state == PROJECT_STATE_OUTDATED;
dialogView->setDialogsHideable(hideable);
dialogView->setUpdateIndexingStatus(true);
if (info.mode != REFRESH_ALL_FILES && (info.filesToClear.size() || info.nonIndexedFilesToClear.size()))
{
@@ -560,7 +561,6 @@ void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> di
taskSequential->addTask(std::make_shared<TaskLambda>([dialogView, this]() {
m_isIndexing = false;
dialogView->setDialogsHideable(false);
dialogView->setUpdateIndexingStatus(false);
MessageIndexingFinished().dispatch();
}));
@@ -12,16 +12,14 @@ public:
return "MessageIndexingStatus";
}
MessageIndexingStatus(bool showProgress, bool unknownProgress, size_t progressPercent)
MessageIndexingStatus(bool showProgress, size_t progressPercent = 0)
: showProgress(showProgress)
, unknownProgress(unknownProgress)
, progressPercent(progressPercent)
{
setSendAsTask(false);
}
const bool showProgress;
const bool unknownProgress;
const size_t progressPercent;
};