| 673 | } |
| 674 | |
| 675 | void BackgroundParser::removeDocument(const IndexedString& url, QObject* notifyWhenReady) |
| 676 | { |
| 677 | Q_D(BackgroundParser); |
| 678 | |
| 679 | Q_ASSERT(isValidURL(url)); |
| 680 | |
| 681 | QMutexLocker lock(&d->m_mutex); |
| 682 | |
| 683 | auto documentParsePlanIt = d->m_documents.find(url); |
| 684 | if (documentParsePlanIt != d->m_documents.end()) { |
| 685 | auto& documentParsePlan = *documentParsePlanIt; |
| 686 | d->m_documentsForPriority[documentParsePlan.priority()].remove(url); |
| 687 | |
| 688 | documentParsePlan.removeTargetsForListener(notifyWhenReady); |
| 689 | |
| 690 | if (documentParsePlan.targets().isEmpty()) { |
| 691 | d->m_documents.erase(documentParsePlanIt); |
| 692 | --d->m_maxParseJobs; |
| 693 | } else { |
| 694 | //Insert with an eventually different priority |
| 695 | d->m_documentsForPriority[documentParsePlan.priority()].insert(url); |
| 696 | } |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | void BackgroundParser::parseDocuments() |
| 701 | { |