Commit 7528b2c6 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Compute the dependecy table on demand.

parent f30f1b66
...@@ -153,14 +153,6 @@ CppFindReferences::CppFindReferences(CppTools::CppModelManagerInterface *modelMa ...@@ -153,14 +153,6 @@ CppFindReferences::CppFindReferences(CppTools::CppModelManagerInterface *modelMa
m_watcher.setPendingResultsLimit(1); m_watcher.setPendingResultsLimit(1);
connect(&m_watcher, SIGNAL(resultsReadyAt(int,int)), this, SLOT(displayResults(int,int))); connect(&m_watcher, SIGNAL(resultsReadyAt(int,int)), this, SLOT(displayResults(int,int)));
connect(&m_watcher, SIGNAL(finished()), this, SLOT(searchFinished())); connect(&m_watcher, SIGNAL(finished()), this, SLOT(searchFinished()));
m_updateDependencyTableTimer = new QTimer(this);
m_updateDependencyTableTimer->setSingleShot(true);
m_updateDependencyTableTimer->setInterval(2000);
connect(m_updateDependencyTableTimer, SIGNAL(timeout()),
this, SLOT(updateDependencyTable()));
connect(modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
m_updateDependencyTableTimer, SLOT(start()));
} }
CppFindReferences::~CppFindReferences() CppFindReferences::~CppFindReferences()
...@@ -231,8 +223,7 @@ static CPlusPlus::DependencyTable dependencyTable(DependencyTable previous, CPlu ...@@ -231,8 +223,7 @@ static CPlusPlus::DependencyTable dependencyTable(DependencyTable previous, CPlu
void CppFindReferences::updateDependencyTable() void CppFindReferences::updateDependencyTable()
{ {
m_depsFuture.cancel(); m_deps = dependencyTable(m_deps, _modelManager->snapshot());
m_depsFuture = QtConcurrent::run(&dependencyTable, m_deps, _modelManager->snapshot());
} }
void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context)
...@@ -276,7 +267,6 @@ void CppFindReferences::findAll_helper(Symbol *symbol, const LookupContext &cont ...@@ -276,7 +267,6 @@ void CppFindReferences::findAll_helper(Symbol *symbol, const LookupContext &cont
Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager();
updateDependencyTable(); // ensure the dependency table is updated updateDependencyTable(); // ensure the dependency table is updated
m_deps = m_depsFuture;
QFuture<Usage> result; QFuture<Usage> result;
...@@ -436,7 +426,6 @@ void CppFindReferences::findMacroUses(const Macro &macro) ...@@ -436,7 +426,6 @@ void CppFindReferences::findMacroUses(const Macro &macro)
} }
updateDependencyTable(); // ensure the dependency table is updated updateDependencyTable(); // ensure the dependency table is updated
m_deps = m_depsFuture;
QFuture<Usage> result; QFuture<Usage> result;
result = QtConcurrent::run(&findMacroUses_helper, workingCopy, snapshot, m_deps, macro); result = QtConcurrent::run(&findMacroUses_helper, workingCopy, snapshot, m_deps, macro);
......
...@@ -85,8 +85,6 @@ private: ...@@ -85,8 +85,6 @@ private:
Find::SearchResultWindow *_resultWindow; Find::SearchResultWindow *_resultWindow;
QFutureWatcher<CPlusPlus::Usage> m_watcher; QFutureWatcher<CPlusPlus::Usage> m_watcher;
CPlusPlus::DependencyTable m_deps; CPlusPlus::DependencyTable m_deps;
QFuture<CPlusPlus::DependencyTable> m_depsFuture;
QTimer *m_updateDependencyTableTimer;
}; };
} // end of namespace Internal } // end of namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment