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 CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
21 #include "content/common/gpu/client/command_buffer_metrics.h" | 21 #include "content/common/gpu/client/command_buffer_metrics.h" |
22 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 22 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
23 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 23 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 24 #include "gpu/ipc/common/gpu_stream_constants.h" |
24 #include "gpu/ipc/common/surface_handle.h" | 25 #include "gpu/ipc/common/surface_handle.h" |
25 #include "third_party/WebKit/public/platform/WebString.h" | 26 #include "third_party/WebKit/public/platform/WebString.h" |
26 #include "ui/gl/gpu_preference.h" | 27 #include "ui/gl/gpu_preference.h" |
27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
28 | 29 |
29 namespace gpu { | 30 namespace gpu { |
30 | 31 |
31 class ContextSupport; | 32 class ContextSupport; |
32 class GpuChannelHost; | 33 class GpuChannelHost; |
33 struct SharedMemoryLimits; | 34 struct SharedMemoryLimits; |
(...skipping 26 matching lines...) Expand all Loading... |
60 // If surface_handle is not kNullSurfaceHandle, this creates a | 61 // If surface_handle is not kNullSurfaceHandle, this creates a |
61 // CommandBufferProxy that renders directly to a view. The view and | 62 // CommandBufferProxy that renders directly to a view. The view and |
62 // the associated window must not be destroyed until the returned | 63 // the associated window must not be destroyed until the returned |
63 // CommandBufferProxy has been destroyed, otherwise the GPU process might | 64 // CommandBufferProxy has been destroyed, otherwise the GPU process might |
64 // attempt to render to an invalid window handle. | 65 // attempt to render to an invalid window handle. |
65 CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl( | 66 CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl( |
66 gpu::SurfaceHandle surface_handle, | 67 gpu::SurfaceHandle surface_handle, |
67 const GURL& active_url, | 68 const GURL& active_url, |
68 scoped_refptr<gpu::GpuChannelHost> host, | 69 scoped_refptr<gpu::GpuChannelHost> host, |
69 gfx::GpuPreference gpu_preference, | 70 gfx::GpuPreference gpu_preference, |
70 bool automatic_flushes); | 71 bool automatic_flushes, |
| 72 int32_t stream_id, |
| 73 gpu::GpuStreamPriority stream_priority); |
71 | 74 |
72 CONTENT_EXPORT ~WebGraphicsContext3DCommandBufferImpl(); | 75 CONTENT_EXPORT ~WebGraphicsContext3DCommandBufferImpl(); |
73 | 76 |
74 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { | 77 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { |
75 return command_buffer_.get(); | 78 return command_buffer_.get(); |
76 } | 79 } |
77 | 80 |
78 CONTENT_EXPORT gpu::ContextSupport* GetContextSupport(); | 81 CONTENT_EXPORT gpu::ContextSupport* GetContextSupport(); |
79 | 82 |
80 gpu::gles2::GLES2Implementation* GetImplementation() { | 83 gpu::gles2::GLES2Implementation* GetImplementation() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 scoped_refptr<gpu::gles2::ShareGroup> share_group, | 119 scoped_refptr<gpu::gles2::ShareGroup> share_group, |
117 const gpu::gles2::ContextCreationAttribHelper& attributes, | 120 const gpu::gles2::ContextCreationAttribHelper& attributes, |
118 command_buffer_metrics::ContextType context_type); | 121 command_buffer_metrics::ContextType context_type); |
119 | 122 |
120 void OnContextLost(); | 123 void OnContextLost(); |
121 | 124 |
122 bool initialized_ = false; | 125 bool initialized_ = false; |
123 bool initialize_failed_ = false; | 126 bool initialize_failed_ = false; |
124 WebGraphicsContextLostCallback* context_lost_callback_ = nullptr; | 127 WebGraphicsContextLostCallback* context_lost_callback_ = nullptr; |
125 | 128 |
126 bool automatic_flushes_; | |
127 | |
128 // State needed by MaybeInitializeGL. | 129 // State needed by MaybeInitializeGL. |
129 scoped_refptr<gpu::GpuChannelHost> host_; | 130 scoped_refptr<gpu::GpuChannelHost> host_; |
130 gpu::SurfaceHandle surface_handle_; | 131 gpu::SurfaceHandle surface_handle_; |
131 GURL active_url_; | 132 GURL active_url_; |
132 | |
133 gfx::GpuPreference gpu_preference_; | 133 gfx::GpuPreference gpu_preference_; |
| 134 bool automatic_flushes_; |
| 135 int32_t stream_id_; |
| 136 gpu::GpuStreamPriority stream_priority_; |
134 | 137 |
135 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | 138 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
136 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 139 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
137 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; | 140 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; |
138 std::unique_ptr<gpu::gles2::GLES2Implementation> real_gl_; | 141 std::unique_ptr<gpu::gles2::GLES2Implementation> real_gl_; |
139 std::unique_ptr<gpu::gles2::GLES2Interface> trace_gl_; | 142 std::unique_ptr<gpu::gles2::GLES2Interface> trace_gl_; |
140 | 143 |
141 // Member variables should appear before the WeakPtrFactory, to ensure | 144 // Member variables should appear before the WeakPtrFactory, to ensure |
142 // that any WeakPtrs to Controller are invalidated before its members | 145 // that any WeakPtrs to Controller are invalidated before its members |
143 // variable's destructors are executed, rendering them invalid. | 146 // variable's destructors are executed, rendering them invalid. |
144 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_; | 147 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_; |
145 }; | 148 }; |
146 | 149 |
147 } // namespace content | 150 } // namespace content |
148 | 151 |
149 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 152 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |