Change createGmmContextWrapperFunc to return unique ptr

Change-Id: I74e6c5b1a49ed19f24933edd3062c62d9256f2d8
This commit is contained in:
Mateusz Jablonski
2018-07-27 14:08:40 +02:00
committed by sys_ocldev
parent c5becf63f7
commit df2f29907c
4 changed files with 5 additions and 6 deletions

View File

@@ -37,8 +37,8 @@ class GmmClientContextBase {
MOCKABLE_VIRTUAL void destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo);
GMM_CLIENT_CONTEXT *getHandle() const;
template <typename T>
static GmmClientContext *create(GMM_CLIENT clientType) {
return new T(clientType);
static std::unique_ptr<GmmClientContext> create(GMM_CLIENT clientType) {
return std::make_unique<T>(clientType);
}
protected:

View File

@@ -56,7 +56,7 @@ void GmmHelper::initContext(const PLATFORM *pPlatform,
loadLib();
bool success = GMM_SUCCESS == GmmHelper::initGlobalContextFunc(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo);
UNRECOVERABLE_IF(!success);
gmmClientContext.reset(GmmHelper::createGmmContextWrapperFunc(GMM_CLIENT::GMM_OCL_VISTA));
gmmClientContext = GmmHelper::createGmmContextWrapperFunc(GMM_CLIENT::GMM_OCL_VISTA);
UNRECOVERABLE_IF(!gmmClientContext);
}
@@ -167,7 +167,7 @@ GmmHelper::~GmmHelper() {
GmmHelper::destroyGlobalContextFunc();
};
bool GmmHelper::useSimplifiedMocsTable = false;
GmmClientContext *(*GmmHelper::createGmmContextWrapperFunc)(GMM_CLIENT) = GmmClientContextBase::create<GmmClientContext>;
decltype(GmmHelper::createGmmContextWrapperFunc) GmmHelper::createGmmContextWrapperFunc = GmmClientContextBase::create<GmmClientContext>;
const HardwareInfo *GmmHelper::hwInfo = nullptr;
} // namespace OCLRT

View File

@@ -68,7 +68,7 @@ class GmmHelper {
static decltype(GmmExportEntries::pfnCreateClientContext) createClientContextFunc;
static decltype(GmmExportEntries::pfnDeleteClientContext) deleteClientContextFunc;
static GmmClientContext *(*createGmmContextWrapperFunc)(GMM_CLIENT);
static std::unique_ptr<GmmClientContext> (*createGmmContextWrapperFunc)(GMM_CLIENT);
static bool useSimplifiedMocsTable;
static const HardwareInfo *hwInfo;