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 #ifndef GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
6 #define GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 6 #define GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "gpu/blink/gpu_blink_export.h" | 14 #include "gpu/blink/gpu_blink_export.h" |
15 #include "gpu/blink/webgraphicscontext3d_impl.h" | 15 #include "gpu/blink/webgraphicscontext3d_impl.h" |
16 #include "gpu/command_buffer/client/gl_in_process_context.h" | 16 #include "gpu/command_buffer/client/gl_in_process_context.h" |
17 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 17 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
18 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
20 | 20 |
21 namespace gpu { | 21 namespace gpu { |
22 class ContextSupport; | 22 class ContextSupport; |
23 class GLInProcessContext; | 23 class GLInProcessContext; |
24 | 24 |
25 namespace gles2 { | 25 namespace gles2 { |
26 class GLES2Interface; | 26 class GLES2Interface; |
27 class GLES2Implementation; | 27 class GLES2Implementation; |
28 struct ContextCreationAttribHelper; | 28 struct ContextCreationAttribHelper; |
29 } | 29 } |
30 } | 30 } |
31 | 31 |
32 namespace gpu_blink { | 32 namespace gpu_blink { |
33 | 33 |
34 class GPU_BLINK_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl | 34 class GPU_BLINK_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl |
35 : public WebGraphicsContext3DImpl { | 35 : public WebGraphicsContext3DImpl { |
36 public: | 36 public: |
37 enum MappedMemoryReclaimLimit { | 37 enum MappedMemoryReclaimLimit { |
38 kNoLimit = 0, | 38 kNoLimit = 0, |
39 }; | 39 }; |
40 | 40 |
41 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 41 static std::unique_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
42 CreateOffscreenContext( | 42 CreateOffscreenContext( |
43 const gpu::gles2::ContextCreationAttribHelper& attributes, | 43 const gpu::gles2::ContextCreationAttribHelper& attributes, |
44 bool share_resources); | 44 bool share_resources); |
45 | 45 |
46 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( | 46 static std::unique_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
47 scoped_ptr<::gpu::GLInProcessContext> context, | 47 WrapContext(std::unique_ptr<::gpu::GLInProcessContext> context, |
48 const gpu::gles2::ContextCreationAttribHelper& attributes); | 48 const gpu::gles2::ContextCreationAttribHelper& attributes); |
49 | 49 |
50 ~WebGraphicsContext3DInProcessCommandBufferImpl() override; | 50 ~WebGraphicsContext3DInProcessCommandBufferImpl() override; |
51 | 51 |
52 size_t GetMappedMemoryLimit(); | 52 size_t GetMappedMemoryLimit(); |
53 | 53 |
54 bool InitializeOnCurrentThread(); | 54 bool InitializeOnCurrentThread(); |
55 void SetLock(base::Lock* lock); | 55 void SetLock(base::Lock* lock); |
56 | 56 |
57 ::gpu::ContextSupport* GetContextSupport(); | 57 ::gpu::ContextSupport* GetContextSupport(); |
58 | 58 |
59 ::gpu::gles2::GLES2Implementation* GetImplementation() { | 59 ::gpu::gles2::GLES2Implementation* GetImplementation() { |
60 return real_gl_; | 60 return real_gl_; |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 WebGraphicsContext3DInProcessCommandBufferImpl( | 64 WebGraphicsContext3DInProcessCommandBufferImpl( |
65 scoped_ptr<::gpu::GLInProcessContext> context, | 65 std::unique_ptr<::gpu::GLInProcessContext> context, |
66 const gpu::gles2::ContextCreationAttribHelper& attributes, | 66 const gpu::gles2::ContextCreationAttribHelper& attributes, |
67 bool share_resources, | 67 bool share_resources, |
68 bool is_offscreen, | 68 bool is_offscreen, |
69 gfx::AcceleratedWidget window); | 69 gfx::AcceleratedWidget window); |
70 | 70 |
71 void OnContextLost(); | 71 void OnContextLost(); |
72 | 72 |
73 bool MaybeInitializeGL(); | 73 bool MaybeInitializeGL(); |
74 | 74 |
75 // Used to try to find bugs in code that calls gl directly through the gl api | 75 // Used to try to find bugs in code that calls gl directly through the gl api |
76 // instead of going through WebGraphicsContext3D. | 76 // instead of going through WebGraphicsContext3D. |
77 void ClearContext(); | 77 void ClearContext(); |
78 | 78 |
79 ::gpu::gles2::ContextCreationAttribHelper attributes_; | 79 ::gpu::gles2::ContextCreationAttribHelper attributes_; |
80 bool share_resources_; | 80 bool share_resources_; |
81 | 81 |
82 bool is_offscreen_; | 82 bool is_offscreen_; |
83 // Only used when not offscreen. | 83 // Only used when not offscreen. |
84 gfx::AcceleratedWidget window_; | 84 gfx::AcceleratedWidget window_; |
85 | 85 |
86 // The context we use for OpenGL rendering. | 86 // The context we use for OpenGL rendering. |
87 scoped_ptr< ::gpu::GLInProcessContext> context_; | 87 std::unique_ptr<::gpu::GLInProcessContext> context_; |
88 // The GLES2Implementation we use for OpenGL rendering. | 88 // The GLES2Implementation we use for OpenGL rendering. |
89 ::gpu::gles2::GLES2Implementation* real_gl_; | 89 ::gpu::gles2::GLES2Implementation* real_gl_; |
90 }; | 90 }; |
91 | 91 |
92 } // namespace gpu_blink | 92 } // namespace gpu_blink |
93 | 93 |
94 #endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 94 #endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |