Changeset View
Changeset View
Standalone View
Standalone View
language/backgroundparser/backgroundparser.cpp
Show All 17 Lines | |||||
18 | * You should have received a copy of the GNU General Public | 18 | * You should have received a copy of the GNU General Public | ||
19 | * License along with this program; if not, write to the | 19 | * License along with this program; if not, write to the | ||
20 | * Free Software Foundation, Inc., | 20 | * Free Software Foundation, Inc., | ||
21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #include "backgroundparser.h" | 24 | #include "backgroundparser.h" | ||
25 | 25 | | |||
26 | #include <QCoreApplication> | ||||
26 | #include <QList> | 27 | #include <QList> | ||
27 | #include <QMutex> | 28 | #include <QMutex> | ||
28 | #include <QMutexLocker> | 29 | #include <QMutexLocker> | ||
29 | #include <QPointer> | 30 | #include <QPointer> | ||
30 | #include <QTimer> | 31 | #include <QTimer> | ||
31 | #include <QThread> | 32 | #include <QThread> | ||
32 | 33 | | |||
33 | #include <KConfigGroup> | 34 | #include <KConfigGroup> | ||
▲ Show 20 Lines • Show All 772 Lines • ▼ Show 20 Line(s) | |||||
806 | } | 807 | } | ||
807 | 808 | | |||
808 | QList< IndexedString > BackgroundParser::managedDocuments() | 809 | QList< IndexedString > BackgroundParser::managedDocuments() | ||
809 | { | 810 | { | ||
810 | QMutexLocker l(&d->m_managedMutex); | 811 | QMutexLocker l(&d->m_managedMutex); | ||
811 | return d->m_managed.keys(); | 812 | return d->m_managed.keys(); | ||
812 | } | 813 | } | ||
813 | 814 | | |||
815 | | ||||
816 | bool BackgroundParser::waitForIdle() const | ||||
brauch: why this bool return type? | |||||
817 | { | ||||
818 | QList<IndexedString> runningParseJobsUrls; | ||||
819 | forever { | ||||
820 | { | ||||
821 | QMutexLocker lock(&d->m_mutex); | ||||
822 | if (d->m_parseJobs.isEmpty()) { | ||||
823 | qCDebug(LANGUAGE) << "All parse jobs done" << d->m_parseJobs.keys(); | ||||
824 | return true; | ||||
825 | } | ||||
826 | | ||||
827 | if (d->m_parseJobs.size() != runningParseJobsUrls.size()) { | ||||
828 | runningParseJobsUrls = d->m_parseJobs.keys(); | ||||
829 | qCDebug(LANGUAGE) << "Waiting for background parser to get in idle state... -- the following parse jobs are still running:" << runningParseJobsUrls; | ||||
830 | } | ||||
831 | } | ||||
832 | | ||||
833 | QCoreApplication::processEvents(); | ||||
834 | QThread::msleep(100); | ||||
835 | } | ||||
836 | return false; | ||||
837 | } | ||||
838 | | ||||
814 | DocumentChangeTracker* BackgroundParser::trackerForUrl(const KDevelop::IndexedString& url) const | 839 | DocumentChangeTracker* BackgroundParser::trackerForUrl(const KDevelop::IndexedString& url) const | ||
815 | { | 840 | { | ||
816 | if (url.isEmpty()) { | 841 | if (url.isEmpty()) { | ||
817 | // this happens e.g. when setting the final location of a problem that is not | 842 | // this happens e.g. when setting the final location of a problem that is not | ||
818 | // yet associated with a top ctx. | 843 | // yet associated with a top ctx. | ||
819 | return nullptr; | 844 | return nullptr; | ||
820 | } | 845 | } | ||
821 | if ( !isValidURL(url) ) { | 846 | if ( !isValidURL(url) ) { | ||
▲ Show 20 Lines • Show All 95 Lines • Show Last 20 Lines |
why this bool return type?