Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Side by Side Diff: mojo/gles2/control_thunks_impl.cc

Issue 2069663002: Some scoped_ptr -> std::unique_ptr conversion, especially under //mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.cc ('k') | mojo/gles2/gles2_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/gles2/control_thunks_impl.h" 5 #include "mojo/gles2/control_thunks_impl.h"
6 6
7 #include <memory>
8
7 #include "mojo/gles2/gles2_context.h" 9 #include "mojo/gles2/gles2_context.h"
8 #include "mojo/public/cpp/system/message_pipe.h" 10 #include "mojo/public/cpp/system/message_pipe.h"
9 11
10 extern "C" { 12 extern "C" {
11 13
12 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ 14 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
13 ReturnType MojoGLES2gl##Function PARAMETERS; 15 ReturnType MojoGLES2gl##Function PARAMETERS;
14 #include "mojo/public/platform/native/gles2/call_visitor.h" 16 #include "mojo/public/platform/native/gles2/call_visitor.h"
15 #undef VISIT_GL_CALL 17 #undef VISIT_GL_CALL
16 18
17 } 19 }
18 20
19 namespace gles2 { 21 namespace gles2 {
20 22
21 // static 23 // static
22 ControlThunksImpl* ControlThunksImpl::Get() { 24 ControlThunksImpl* ControlThunksImpl::Get() {
23 static auto* thunks = new ControlThunksImpl; 25 static auto* thunks = new ControlThunksImpl;
24 return thunks; 26 return thunks;
25 } 27 }
26 28
27 MGLContext ControlThunksImpl::CreateContext( 29 MGLContext ControlThunksImpl::CreateContext(
28 MGLOpenGLAPIVersion version, 30 MGLOpenGLAPIVersion version,
29 MojoHandle command_buffer_handle, 31 MojoHandle command_buffer_handle,
30 MGLContext share_group, 32 MGLContext share_group,
31 MGLContextLostCallback lost_callback, 33 MGLContextLostCallback lost_callback,
32 void* lost_callback_closure, 34 void* lost_callback_closure,
33 const struct MojoAsyncWaiter* async_waiter) { 35 const struct MojoAsyncWaiter* async_waiter) {
34 mojo::MessagePipeHandle mph(command_buffer_handle); 36 mojo::MessagePipeHandle mph(command_buffer_handle);
35 mojo::ScopedMessagePipeHandle scoped_handle(mph); 37 mojo::ScopedMessagePipeHandle scoped_handle(mph);
36 scoped_ptr<GLES2Context> client( 38 std::unique_ptr<GLES2Context> client(
37 new GLES2Context(async_waiter, scoped_handle.Pass(), lost_callback, 39 new GLES2Context(async_waiter, scoped_handle.Pass(), lost_callback,
38 lost_callback_closure)); 40 lost_callback_closure));
39 if (!client->Initialize()) 41 if (!client->Initialize())
40 client.reset(); 42 client.reset();
41 return client.release(); 43 return client.release();
42 } 44 }
43 45
44 void ControlThunksImpl::DestroyContext(MGLContext context) { 46 void ControlThunksImpl::DestroyContext(MGLContext context) {
45 delete static_cast<GLES2Context*>(context); 47 delete static_cast<GLES2Context*>(context);
46 } 48 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return current_context_tls_.Get()->interface(); 99 return current_context_tls_.Get()->interface();
98 } 100 }
99 101
100 ControlThunksImpl::ControlThunksImpl() { 102 ControlThunksImpl::ControlThunksImpl() {
101 } 103 }
102 104
103 ControlThunksImpl::~ControlThunksImpl() { 105 ControlThunksImpl::~ControlThunksImpl() {
104 } 106 }
105 107
106 } // namespace gles2 108 } // namespace gles2
OLDNEW
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.cc ('k') | mojo/gles2/gles2_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698