Skip to content

Commit ff0d132

Browse files
Use make_unique in sharings
Change-Id: If4fa5e748d673dedf85bc96d4311fcaf8c88a64e Signed-off-by: Filip Hazubski <[email protected]>
1 parent 9bb6251 commit ff0d132

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

runtime/sharings/d3d/enable_d3d.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace NEO {
2323

2424
bool D3DSharingContextBuilder<D3DTypesHelper::D3D9>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
2525
if (contextData.get() == nullptr) {
26-
contextData.reset(new D3DCreateContextProperties<D3DTypesHelper::D3D9>);
26+
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D9>>();
2727
}
2828
bool res = false;
2929

@@ -44,7 +44,7 @@ bool D3DSharingContextBuilder<D3DTypesHelper::D3D9>::processProperties(cl_contex
4444

4545
bool D3DSharingContextBuilder<D3DTypesHelper::D3D10>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
4646
if (contextData.get() == nullptr) {
47-
contextData.reset(new D3DCreateContextProperties<D3DTypesHelper::D3D10>);
47+
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D10>>();
4848
}
4949
bool res = false;
5050

@@ -60,7 +60,7 @@ bool D3DSharingContextBuilder<D3DTypesHelper::D3D10>::processProperties(cl_conte
6060

6161
bool D3DSharingContextBuilder<D3DTypesHelper::D3D11>::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
6262
if (contextData.get() == nullptr) {
63-
contextData.reset(new D3DCreateContextProperties<D3DTypesHelper::D3D11>);
63+
contextData = std::make_unique<D3DCreateContextProperties<D3DTypesHelper::D3D11>>();
6464
}
6565
bool res = false;
6666
switch (propertyType) {
@@ -99,7 +99,7 @@ bool D3DSharingContextBuilder<D3D>::finalizeProperties(Context &context, int32_t
9999

100100
template <typename D3D>
101101
std::unique_ptr<SharingContextBuilder> D3DSharingBuilderFactory<D3D>::createContextBuilder() {
102-
return std::unique_ptr<SharingContextBuilder>(new D3DSharingContextBuilder<D3D>());
102+
return std::make_unique<D3DSharingContextBuilder<D3D>>();
103103
};
104104

105105
std::string D3DSharingBuilderFactory<D3DTypesHelper::D3D9>::getExtensions() {

runtime/sharings/gl/cl_gl_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties *properties
337337
return retVal;
338338
}
339339

340-
std::unique_ptr<GLSharingFunctions> glSharing(new GLSharingFunctions);
340+
auto glSharing = std::make_unique<GLSharingFunctions>();
341341
glSharing->initGLFunctions();
342342
if (glSharing->isOpenGlSharingSupported() == false) {
343343
retVal = CL_INVALID_CONTEXT;

runtime/sharings/gl/gl_arb_sync_event.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
namespace NEO {
2222
GlArbSyncEvent::GlArbSyncEvent(Context &context)
2323
: Event(&context, nullptr, CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR, eventNotReady, eventNotReady),
24-
glSyncInfo(new CL_GL_SYNC_INFO{}) {
24+
glSyncInfo(std::make_unique<CL_GL_SYNC_INFO>()) {
2525
}
2626

2727
bool GlArbSyncEvent::setBaseEvent(Event &ev) {

runtime/sharings/gl/gl_sync_event.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
namespace NEO {
2323
GlSyncEvent::GlSyncEvent(Context &context, const GL_CL_SYNC_INFO &sync)
24-
: Event(&context, nullptr, CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR, eventNotReady, eventNotReady), glSync(new GL_CL_SYNC_INFO(sync)) {
24+
: Event(&context, nullptr, CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR, eventNotReady, eventNotReady),
25+
glSync(std::make_unique<GL_CL_SYNC_INFO>(sync)) {
2526
transitionExecutionStatus(CL_SUBMITTED);
2627
}
2728

runtime/sharings/gl/win_enable_gl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace NEO {
2121
bool GlSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue,
2222
cl_int &errcodeRet) {
2323
if (contextData.get() == nullptr) {
24-
contextData.reset(new GlCreateContextProperties);
24+
contextData = std::make_unique<GlCreateContextProperties>();
2525
}
2626
bool res = false;
2727

@@ -67,7 +67,7 @@ bool GlSharingContextBuilder::finalizeProperties(Context &context, int32_t &errc
6767
}
6868

6969
std::unique_ptr<SharingContextBuilder> GlSharingBuilderFactory::createContextBuilder() {
70-
return std::unique_ptr<SharingContextBuilder>(new GlSharingContextBuilder());
70+
return std::make_unique<GlSharingContextBuilder>();
7171
};
7272

7373
void GlSharingBuilderFactory::fillGlobalDispatchTable() {

runtime/sharings/sharing_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace NEO {
1414

1515
std::unique_ptr<SharingFactory> SharingFactory::build() {
16-
std::unique_ptr<SharingFactory> res(new SharingFactory());
16+
auto res = std::make_unique<SharingFactory>();
1717

1818
for (auto &builder : sharingContextBuilder) {
1919
if (builder == nullptr)

runtime/sharings/va/enable_va.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace NEO {
2323

2424
bool VaSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue, cl_int &errcodeRet) {
2525
if (contextData.get() == nullptr) {
26-
contextData.reset(new VaCreateContextProperties);
26+
contextData = std::make_unique<VaCreateContextProperties>();
2727
}
2828
bool res = false;
2929

@@ -53,7 +53,7 @@ bool VaSharingContextBuilder::finalizeProperties(Context &context, int32_t &errc
5353
}
5454

5555
std::unique_ptr<SharingContextBuilder> VaSharingBuilderFactory::createContextBuilder() {
56-
return std::unique_ptr<SharingContextBuilder>(new VaSharingContextBuilder());
56+
return std::make_unique<VaSharingContextBuilder>();
5757
};
5858

5959
std::string VaSharingBuilderFactory::getExtensions() {

0 commit comments

Comments
 (0)