logic: Fixed bugs in TaskParse scheduling
* Added TaskParse as base for TaskParseCxx and TaskParseJava * Fixed increment and decrement of indexer_count on blackboard not atomic * Fixed TaskInjectStorage finished before TaskParse started * Fixed project not cleared when refreshing on now empty project * Fixed TaskInjectStorage overheating when nothing to do
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
#include "data/parser/cxx/TaskParseCxx.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "clang/Tooling/JSONCompilationDatabase.h"
|
||||
|
||||
#include "component/view/DialogView.h"
|
||||
#include "data/parser/cxx/CxxParser.h"
|
||||
#include "data/parser/ParserClientImpl.h"
|
||||
#include "data/StorageProvider.h"
|
||||
#include "utility/file/FileRegister.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
std::vector<FilePath> TaskParseCxx::getSourceFilesFromCDB(const FilePath& compilationDatabasePath)
|
||||
{
|
||||
@@ -35,11 +33,8 @@ TaskParseCxx::TaskParseCxx(
|
||||
const Parser::Arguments& arguments,
|
||||
DialogView* dialogView
|
||||
)
|
||||
: m_storageProvider(storageProvider)
|
||||
, m_arguments(arguments)
|
||||
, m_dialogView(dialogView)
|
||||
: TaskParse(storageProvider, fileRegister, arguments, dialogView)
|
||||
, m_isCDB(false)
|
||||
, m_interrupted(false)
|
||||
{
|
||||
if (arguments.compilationDatabasePath.exists())
|
||||
{
|
||||
@@ -51,12 +46,7 @@ TaskParseCxx::TaskParseCxx(
|
||||
|
||||
void TaskParseCxx::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
int indexerCount = 0;
|
||||
if (blackboard->get("indexer_count", indexerCount))
|
||||
{
|
||||
indexerCount++;
|
||||
blackboard->set("indexer_count", indexerCount);
|
||||
}
|
||||
TaskParse::doEnter(blackboard);
|
||||
|
||||
if (m_isCDB)
|
||||
{
|
||||
@@ -117,22 +107,3 @@ Task::TaskState TaskParseCxx::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
|
||||
return (m_interrupted ? STATE_FAILURE : STATE_SUCCESS);
|
||||
}
|
||||
|
||||
void TaskParseCxx::doExit(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
int indexerCount = 0;
|
||||
if (blackboard->get("indexer_count", indexerCount))
|
||||
{
|
||||
indexerCount--;
|
||||
blackboard->set("indexer_count", indexerCount);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskParseCxx::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskParseCxx::handleMessage(MessageInterruptTasks* message)
|
||||
{
|
||||
m_interrupted = true;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,10 @@
|
||||
#ifndef TASK_PARSE_CXX_H
|
||||
#define TASK_PARSE_CXX_H
|
||||
|
||||
#include <memory>
|
||||
#include <deque>
|
||||
|
||||
#include "data/parser/Parser.h"
|
||||
#include "data/parser/ParserClientImpl.h"
|
||||
#include "utility/scheduling/Task.h"
|
||||
#include "utility/TimePoint.h"
|
||||
#include "utility/messaging/type/MessageInterruptTasks.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "data/parser/TaskParse.h"
|
||||
|
||||
class CxxParser;
|
||||
class DialogView;
|
||||
class FileRegister;
|
||||
class StorageProvider;
|
||||
class ParserClientImpl;
|
||||
|
||||
namespace clang
|
||||
{
|
||||
@@ -25,8 +15,7 @@ namespace clang
|
||||
}
|
||||
|
||||
class TaskParseCxx
|
||||
: public Task
|
||||
, public MessageListener<MessageInterruptTasks>
|
||||
: public TaskParse
|
||||
{
|
||||
public:
|
||||
static std::vector<FilePath> getSourceFilesFromCDB(const FilePath& compilationDatabasePath);
|
||||
@@ -41,23 +30,12 @@ public:
|
||||
private:
|
||||
virtual void doEnter(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual TaskState doUpdate(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doExit(std::shared_ptr<Blackboard> blackboard);
|
||||
virtual void doReset(std::shared_ptr<Blackboard> blackboard);
|
||||
|
||||
virtual void handleMessage(MessageInterruptTasks* message);
|
||||
|
||||
std::shared_ptr<StorageProvider> m_storageProvider;
|
||||
|
||||
const Parser::Arguments m_arguments;
|
||||
DialogView* m_dialogView;
|
||||
|
||||
std::shared_ptr<CxxParser> m_parser;
|
||||
std::shared_ptr<ParserClientImpl> m_parserClient;
|
||||
|
||||
bool m_isCDB;
|
||||
std::shared_ptr<clang::tooling::JSONCompilationDatabase> m_cdb;
|
||||
|
||||
bool m_interrupted;
|
||||
};
|
||||
|
||||
#endif // TASK_PARSE_CXX_H
|
||||
|
||||
Reference in New Issue
Block a user