CppLocatorData: Don't use recursive mutex

Don't use recursive mutex in CppLocatorData class,
as this is more expensive to construct than simple
QMutex. Refactor the code so that every call to
flushPendingDocument() is done with already locked
m_pendingDocumentsMutex. This eliminates the need
for recursive mutex.

Remove unused allIndexItems() method.

Change-Id: Ic7cb45bc3301d83768e69ee52f84ae159cb731a5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2021-03-09 13:53:34 +01:00
parent 9d9ac537e8
commit 3ab93592c3
2 changed files with 3 additions and 13 deletions

View File

@@ -86,7 +86,6 @@ void CppLocatorData::onAboutToRemoveFiles(const QStringList &files)
void CppLocatorData::flushPendingDocument(bool force) const
{
// TODO: move this off the UI thread and into a future.
QMutexLocker locker(&m_pendingDocumentsMutex);
if (!force && m_pendingDocuments.size() < MaxPendingDocuments)
return;
if (m_pendingDocuments.isEmpty())
@@ -98,12 +97,3 @@ void CppLocatorData::flushPendingDocument(bool force) const
m_pendingDocuments.clear();
m_pendingDocuments.reserve(MaxPendingDocuments);
}
QList<IndexItem::Ptr> CppLocatorData::allIndexItems(
const QHash<QString, QList<IndexItem::Ptr>> &items) const
{
QList<IndexItem::Ptr> result;
for (const QList<IndexItem::Ptr> &subItems : items)
result.append(subItems);
return result;
}