| 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 is_offscreen = true; | 39 bool is_offscreen = true; |
| 39 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( | 40 return base::WrapUnique(new WebGraphicsContext3DInProcessCommandBufferImpl( |
| 40 scoped_ptr<::gpu::GLInProcessContext>(), attributes, is_offscreen, | 41 std::unique_ptr<::gpu::GLInProcessContext>(), attributes, is_offscreen, |
| 41 gfx::kNullAcceleratedWidget)); | 42 gfx::kNullAcceleratedWidget)); |
| 42 } | 43 } |
| 43 | 44 |
| 44 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 45 std::unique_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 45 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 46 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 46 scoped_ptr<::gpu::GLInProcessContext> context, | 47 std::unique_ptr<::gpu::GLInProcessContext> context, |
| 47 const gpu::gles2::ContextCreationAttribHelper& attributes) { | 48 const gpu::gles2::ContextCreationAttribHelper& attributes) { |
| 48 bool is_offscreen = true; // Not used. | 49 bool is_offscreen = true; // Not used. |
| 49 gfx::AcceleratedWidget window = gfx::kNullAcceleratedWidget; // Not used. | 50 gfx::AcceleratedWidget window = gfx::kNullAcceleratedWidget; // Not used. |
| 50 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( | 51 return base::WrapUnique(new WebGraphicsContext3DInProcessCommandBufferImpl( |
| 51 std::move(context), attributes, is_offscreen, window)); | 52 std::move(context), attributes, is_offscreen, window)); |
| 52 } | 53 } |
| 53 | 54 |
| 54 WebGraphicsContext3DInProcessCommandBufferImpl:: | 55 WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 55 WebGraphicsContext3DInProcessCommandBufferImpl( | 56 WebGraphicsContext3DInProcessCommandBufferImpl( |
| 56 scoped_ptr<::gpu::GLInProcessContext> context, | 57 std::unique_ptr<::gpu::GLInProcessContext> context, |
| 57 const gpu::gles2::ContextCreationAttribHelper& attributes, | 58 const gpu::gles2::ContextCreationAttribHelper& attributes, |
| 58 bool is_offscreen, | 59 bool is_offscreen, |
| 59 gfx::AcceleratedWidget window) | 60 gfx::AcceleratedWidget window) |
| 60 : attributes_(attributes), | 61 : attributes_(attributes), |
| 61 is_offscreen_(is_offscreen), | 62 is_offscreen_(is_offscreen), |
| 62 window_(window), | 63 window_(window), |
| 63 context_(std::move(context)) {} | 64 context_(std::move(context)) {} |
| 64 | 65 |
| 65 WebGraphicsContext3DInProcessCommandBufferImpl:: | 66 WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 66 ~WebGraphicsContext3DInProcessCommandBufferImpl() { | 67 ~WebGraphicsContext3DInProcessCommandBufferImpl() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) { | 125 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) { |
| 125 context_->SetLock(lock); | 126 context_->SetLock(lock); |
| 126 } | 127 } |
| 127 | 128 |
| 128 ::gpu::ContextSupport* | 129 ::gpu::ContextSupport* |
| 129 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { | 130 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { |
| 130 return real_gl_; | 131 return real_gl_; |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace gpu_blink | 134 } // namespace gpu_blink |
| OLD | NEW |