Use make_unique in sharings

Change-Id: If4fa5e748d673dedf85bc96d4311fcaf8c88a64e
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2019-08-13 09:53:54 +02:00
committed by sys_ocldev
parent 9bb625185f
commit ff0d1327f0
7 changed files with 13 additions and 12 deletions

View File

@@ -23,7 +23,7 @@ namespace NEO {
bool D3DSharingContextBuilder<D3DTypesHelper::D3D9>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
if (contextData.get() == nullptr) {
contextData.reset(new D3DCreateContextProperties<D3DTypesHelper::D3D9>);
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D9>>();
}
bool res = false;
@@ -44,7 +44,7 @@ bool D3DSharingContextBuilder<D3DTypesHelper::D3D9>::processProperties(cl_contex
bool D3DSharingContextBuilder<D3DTypesHelper::D3D10>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
if (contextData.get() == nullptr) {
contextData.reset(new D3DCreateContextProperties<D3DTypesHelper::D3D10>);
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D10>>();
}
bool res = false;
@@ -60,7 +60,7 @@ bool D3DSharingContextBuilder<D3DTypesHelper::D3D10>::processProperties(cl_conte
bool D3DSharingContextBuilder<D3DTypesHelper::D3D11>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
if (contextData.get() == nullptr) {
contextData.reset(new D3DCreateContextProperties<D3DTypesHelper::D3D11>);
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D11>>();
}
bool res = false;
switch (propertyType) {
@@ -99,7 +99,7 @@ bool D3DSharingContextBuilder<D3D>::finalizeProperties(Context &context, int32_t
template <typename D3D>
std::unique_ptr<SharingContextBuilder> D3DSharingBuilderFactory<D3D>::createContextBuilder() {
return std::unique_ptr<SharingContextBuilder>(new D3DSharingContextBuilder<D3D>());
return std::make_unique<D3DSharingContextBuilder<D3D>>();
};
std::string D3DSharingBuilderFactory<D3DTypesHelper::D3D9>::getExtensions() {

View File

@@ -337,7 +337,7 @@ cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties *properties
return retVal;
}
std::unique_ptr<GLSharingFunctions> glSharing(new GLSharingFunctions);
auto glSharing = std::make_unique<GLSharingFunctions>();
glSharing->initGLFunctions();
if (glSharing->isOpenGlSharingSupported() == false) {
retVal = CL_INVALID_CONTEXT;

View File

@@ -21,7 +21,7 @@
namespace NEO {
GlArbSyncEvent::GlArbSyncEvent(Context &context)
: Event(&context, nullptr, CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR, eventNotReady, eventNotReady),
glSyncInfo(new CL_GL_SYNC_INFO{}) {
glSyncInfo(std::make_unique<CL_GL_SYNC_INFO>()) {
}
bool GlArbSyncEvent::setBaseEvent(Event &ev) {

View File

@@ -21,7 +21,8 @@
namespace NEO {
GlSyncEvent::GlSyncEvent(Context &context, const GL_CL_SYNC_INFO &sync)
: Event(&context, nullptr, CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR, eventNotReady, eventNotReady), glSync(new GL_CL_SYNC_INFO(sync)) {
: Event(&context, nullptr, CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR, eventNotReady, eventNotReady),
glSync(std::make_unique<GL_CL_SYNC_INFO>(sync)) {
transitionExecutionStatus(CL_SUBMITTED);
}

View File

@@ -21,7 +21,7 @@ namespace NEO {
bool GlSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue,
cl_int &errcodeRet) {
if (contextData.get() == nullptr) {
contextData.reset(new GlCreateContextProperties);
contextData = std::make_unique<GlCreateContextProperties>();
}
bool res = false;
@@ -67,7 +67,7 @@ bool GlSharingContextBuilder::finalizeProperties(Context &context, int32_t &errc
}
std::unique_ptr<SharingContextBuilder> GlSharingBuilderFactory::createContextBuilder() {
return std::unique_ptr<SharingContextBuilder>(new GlSharingContextBuilder());
return std::make_unique<GlSharingContextBuilder>();
};
void GlSharingBuilderFactory::fillGlobalDispatchTable() {

View File

@@ -13,7 +13,7 @@
namespace NEO {
std::unique_ptr<SharingFactory> SharingFactory::build() {
std::unique_ptr<SharingFactory> res(new SharingFactory());
auto res = std::make_unique<SharingFactory>();
for (auto &builder : sharingContextBuilder) {
if (builder == nullptr)

View File

@@ -23,7 +23,7 @@ namespace NEO {
bool VaSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
if (contextData.get() == nullptr) {
contextData.reset(new VaCreateContextProperties);
contextData = std::make_unique<VaCreateContextProperties>();
}
bool res = false;
@@ -53,7 +53,7 @@ bool VaSharingContextBuilder::finalizeProperties(Context &context, int32_t &errc
}
std::unique_ptr<SharingContextBuilder> VaSharingBuilderFactory::createContextBuilder() {
return std::unique_ptr<SharingContextBuilder>(new VaSharingContextBuilder());
return std::make_unique<VaSharingContextBuilder>();
};
std::string VaSharingBuilderFactory::getExtensions() {