Commit 9b1792d4 authored by Milian Wolff's avatar Milian Wolff
Browse files

Minor cleanup: only explicitly share the mutex of type repository

Instead of giving access to the full manager, only let the mutex
be known and reusable for the instantiationinformation repo.
parent fe331012
......@@ -117,18 +117,13 @@ uint InstantiationInformation::hash() const
return kdevhash << previousInstantiationInformation.index();
}
AbstractRepositoryManager* returnTypeRepository()
{
return typeRepositoryManager();
}
static KDevelop::RepositoryManager<KDevelop::ItemRepository<InstantiationInformation,
AppendedListItemRequest<InstantiationInformation>>>& instantiationInformationRepository()
{
static KDevelop::RepositoryManager<
KDevelop::ItemRepository<InstantiationInformation, AppendedListItemRequest<InstantiationInformation>>>
instantiationInformationRepositoryObject(QStringLiteral("Instantiation Information Repository"),
returnTypeRepository()->repositoryMutex());
typeRepositoryMutex());
return instantiationInformationRepositoryObject;
}
......
......@@ -84,12 +84,17 @@ public:
const AbstractType& m_item;
};
//The object is created in a function, to prevent initialization-order issues
static RepositoryManager<ItemRepository<AbstractTypeData, AbstractTypeDataRequest>, false>& typeRepository()
QMutex* typeRepositoryMutex()
{
static auto mutex = QMutex(QMutex::Recursive);
return &mutex;
}
// The object is created in a function, to prevent initialization-order issues
static RepositoryManager<ItemRepository<AbstractTypeData, AbstractTypeDataRequest>, false>& typeRepository()
{
static RepositoryManager<ItemRepository<AbstractTypeData, AbstractTypeDataRequest>, false> repository(
QStringLiteral("Type Repository"), &mutex);
QStringLiteral("Type Repository"), typeRepositoryMutex());
return repository;
}
......@@ -98,11 +103,6 @@ void initTypeRepository()
typeRepository();
}
AbstractRepositoryManager* typeRepositoryManager()
{
return &typeRepository();
}
uint TypeRepository::indexForType(const AbstractType::Ptr& input)
{
if (!input)
......
......@@ -9,9 +9,10 @@
#include <language/duchain/types/abstracttype.h>
class QMutex;
namespace KDevelop {
struct ReferenceCountManager;
class AbstractRepositoryManager;
class TypeRepository
{
......@@ -24,7 +25,7 @@ public:
static void decreaseReferenceCount(uint index, ReferenceCountManager* manager);
};
AbstractRepositoryManager* typeRepositoryManager();
QMutex* typeRepositoryMutex();
}
#endif
Supports Markdown
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