| 1828 | } |
| 1829 | |
| 1830 | KDevelop::ReferencedTopDUContext DUChain::waitForUpdate(const KDevelop::IndexedString& document, |
| 1831 | KDevelop::TopDUContext::Features minFeatures, bool proxyContext) |
| 1832 | { |
| 1833 | Q_ASSERT(!lock()->currentThreadHasReadLock() && !lock()->currentThreadHasWriteLock()); |
| 1834 | |
| 1835 | WaitForUpdate waiter; |
| 1836 | updateContextForUrl(document, minFeatures, &waiter); |
| 1837 | |
| 1838 | while (!waiter.m_ready) { |
| 1839 | // we might have been shut down in the meanwhile |
| 1840 | if (!ICore::self()) { |
| 1841 | return nullptr; |
| 1842 | } |
| 1843 | |
| 1844 | QMetaObject::invokeMethod(ICore::self()->languageController()->backgroundParser(), "parseDocuments"); |
| 1845 | QCoreApplication::processEvents(); |
| 1846 | QThread::usleep(1000); |
| 1847 | } |
| 1848 | |
| 1849 | if (!proxyContext) { |
| 1850 | DUChainReadLocker readLock(DUChain::lock()); |
| 1851 | return DUChainUtils::contentContextFromProxyContext(waiter.m_topContext); |
| 1852 | } |
| 1853 | |
| 1854 | return waiter.m_topContext; |
| 1855 | } |
| 1856 | |
| 1857 | void DUChain::updateContextForUrl(const IndexedString& document, TopDUContext::Features minFeatures, |
| 1858 | QObject* notifyReady, int priority) const |