OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 5 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <utility> | 8 #include <utility> |
9 #ifndef GL_GLEXT_PROTOTYPES | 9 #ifndef GL_GLEXT_PROTOTYPES |
10 #define GL_GLEXT_PROTOTYPES 1 | 10 #define GL_GLEXT_PROTOTYPES 1 |
11 #endif | 11 #endif |
12 #include <GLES2/gl2ext.h> | 12 #include <GLES2/gl2ext.h> |
13 #include <GLES2/gl2extchromium.h> | 13 #include <GLES2/gl2extchromium.h> |
14 #include <stddef.h> | 14 #include <stddef.h> |
15 | 15 |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "base/atomicops.h" | 18 #include "base/atomicops.h" |
19 #include "base/bind.h" | 19 #include "base/bind.h" |
20 #include "base/bind_helpers.h" | 20 #include "base/bind_helpers.h" |
21 #include "base/callback.h" | 21 #include "base/callback.h" |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/memory/ptr_util.h" |
23 #include "gpu/command_buffer/client/gles2_implementation.h" | 24 #include "gpu/command_buffer/client/gles2_implementation.h" |
24 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 25 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
25 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" | 26 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
26 #include "ui/gfx/geometry/size.h" | 27 #include "ui/gfx/geometry/size.h" |
27 #include "ui/gl/gl_implementation.h" | 28 #include "ui/gl/gl_implementation.h" |
28 | 29 |
29 using gpu::gles2::GLES2Implementation; | 30 using gpu::gles2::GLES2Implementation; |
30 using gpu::GLInProcessContext; | 31 using gpu::GLInProcessContext; |
31 | 32 |
32 namespace gpu_blink { | 33 namespace gpu_blink { |
33 | 34 |
34 // static | 35 // static |
35 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 36 std::unique_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
36 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( | 37 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( |
37 const gpu::gles2::ContextCreationAttribHelper& attributes, | 38 const gpu::gles2::ContextCreationAttribHelper& attributes, |
38 bool share_resources) { | 39 bool share_resources) { |
39 bool is_offscreen = true; | 40 bool is_offscreen = true; |
40 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( | 41 return base::WrapUnique(new WebGraphicsContext3DInProcessCommandBufferImpl( |
41 scoped_ptr<::gpu::GLInProcessContext>(), attributes, share_resources, | 42 std::unique_ptr<::gpu::GLInProcessContext>(), attributes, share_resources, |
42 is_offscreen, gfx::kNullAcceleratedWidget)); | 43 is_offscreen, gfx::kNullAcceleratedWidget)); |
43 } | 44 } |
44 | 45 |
45 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 46 std::unique_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
46 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 47 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
47 scoped_ptr<::gpu::GLInProcessContext> context, | 48 std::unique_ptr<::gpu::GLInProcessContext> context, |
48 const gpu::gles2::ContextCreationAttribHelper& attributes) { | 49 const gpu::gles2::ContextCreationAttribHelper& attributes) { |
49 bool is_offscreen = true; // Not used. | 50 bool is_offscreen = true; // Not used. |
50 bool share_resources = false; // Not used. | 51 bool share_resources = false; // Not used. |
51 gfx::AcceleratedWidget window = gfx::kNullAcceleratedWidget; // Not used. | 52 gfx::AcceleratedWidget window = gfx::kNullAcceleratedWidget; // Not used. |
52 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( | 53 return base::WrapUnique(new WebGraphicsContext3DInProcessCommandBufferImpl( |
53 std::move(context), attributes, share_resources, is_offscreen, window)); | 54 std::move(context), attributes, share_resources, is_offscreen, window)); |
54 } | 55 } |
55 | 56 |
56 WebGraphicsContext3DInProcessCommandBufferImpl:: | 57 WebGraphicsContext3DInProcessCommandBufferImpl:: |
57 WebGraphicsContext3DInProcessCommandBufferImpl( | 58 WebGraphicsContext3DInProcessCommandBufferImpl( |
58 scoped_ptr<::gpu::GLInProcessContext> context, | 59 std::unique_ptr<::gpu::GLInProcessContext> context, |
59 const gpu::gles2::ContextCreationAttribHelper& attributes, | 60 const gpu::gles2::ContextCreationAttribHelper& attributes, |
60 bool share_resources, | 61 bool share_resources, |
61 bool is_offscreen, | 62 bool is_offscreen, |
62 gfx::AcceleratedWidget window) | 63 gfx::AcceleratedWidget window) |
63 : attributes_(attributes), | 64 : attributes_(attributes), |
64 share_resources_(share_resources), | 65 share_resources_(share_resources), |
65 is_offscreen_(is_offscreen), | 66 is_offscreen_(is_offscreen), |
66 window_(window), | 67 window_(window), |
67 context_(std::move(context)) {} | 68 context_(std::move(context)) {} |
68 | 69 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return real_gl_; | 135 return real_gl_; |
135 } | 136 } |
136 | 137 |
137 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 138 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
138 if (context_lost_callback_) { | 139 if (context_lost_callback_) { |
139 context_lost_callback_->onContextLost(); | 140 context_lost_callback_->onContextLost(); |
140 } | 141 } |
141 } | 142 } |
142 | 143 |
143 } // namespace gpu_blink | 144 } // namespace gpu_blink |
OLD | NEW |