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

Side by Side Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h

Issue 1827123002: Move content/common/gpu/client to gpu/ipc/client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 8 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
OLDNEW
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 <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "content/common/gpu/client/command_buffer_metrics.h" 20 #include "content/common/gpu/client/command_buffer_metrics.h"
21 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
22 #include "gpu/blink/webgraphicscontext3d_impl.h" 21 #include "gpu/blink/webgraphicscontext3d_impl.h"
23 #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"
24 #include "gpu/ipc/common/surface_handle.h" 24 #include "gpu/ipc/common/surface_handle.h"
25 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 25 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
26 #include "third_party/WebKit/public/platform/WebString.h" 26 #include "third_party/WebKit/public/platform/WebString.h"
27 #include "ui/gl/gpu_preference.h" 27 #include "ui/gl/gpu_preference.h"
28 #include "url/gurl.h" 28 #include "url/gurl.h"
29 29
30 namespace gpu { 30 namespace gpu {
31 31
32 class ContextSupport; 32 class ContextSupport;
33 class GpuChannelHost;
33 class TransferBuffer; 34 class TransferBuffer;
34 35
35 namespace gles2 { 36 namespace gles2 {
36 class GLES2CmdHelper; 37 class GLES2CmdHelper;
37 class GLES2Implementation; 38 class GLES2Implementation;
38 class GLES2Interface; 39 class GLES2Interface;
39 } 40 }
40 } 41 }
41 42
42 namespace content { 43 namespace content {
43 class GpuChannelHost;
44 44
45 const size_t kDefaultCommandBufferSize = 1024 * 1024; 45 const size_t kDefaultCommandBufferSize = 1024 * 1024;
46 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; 46 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024;
47 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; 47 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024;
48 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; 48 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024;
49 49
50 class WebGraphicsContext3DCommandBufferImpl 50 class WebGraphicsContext3DCommandBufferImpl
51 : public gpu_blink::WebGraphicsContext3DImpl { 51 : public gpu_blink::WebGraphicsContext3DImpl {
52 public: 52 public:
53 enum MappedMemoryReclaimLimit { 53 enum MappedMemoryReclaimLimit {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 std::vector<WebGraphicsContext3DCommandBufferImpl*> contexts_; 105 std::vector<WebGraphicsContext3DCommandBufferImpl*> contexts_;
106 base::Lock lock_; 106 base::Lock lock_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(ShareGroup); 108 DISALLOW_COPY_AND_ASSIGN(ShareGroup);
109 }; 109 };
110 110
111 WebGraphicsContext3DCommandBufferImpl( 111 WebGraphicsContext3DCommandBufferImpl(
112 gpu::SurfaceHandle surface_handle, 112 gpu::SurfaceHandle surface_handle,
113 const GURL& active_url, 113 const GURL& active_url,
114 GpuChannelHost* host, 114 gpu::GpuChannelHost* host,
115 const gpu::gles2::ContextCreationAttribHelper& attributes, 115 const gpu::gles2::ContextCreationAttribHelper& attributes,
116 gfx::GpuPreference gpu_preference, 116 gfx::GpuPreference gpu_preference,
117 bool share_resources, 117 bool share_resources,
118 bool automatic_flushes, 118 bool automatic_flushes,
119 const SharedMemoryLimits& limits, 119 const SharedMemoryLimits& limits,
120 WebGraphicsContext3DCommandBufferImpl* share_context); 120 WebGraphicsContext3DCommandBufferImpl* share_context);
121 121
122 ~WebGraphicsContext3DCommandBufferImpl() override; 122 ~WebGraphicsContext3DCommandBufferImpl() override;
123 123
124 CommandBufferProxyImpl* GetCommandBufferProxy() { 124 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() {
125 return command_buffer_.get(); 125 return command_buffer_.get();
126 } 126 }
127 127
128 CONTENT_EXPORT gpu::ContextSupport* GetContextSupport(); 128 CONTENT_EXPORT gpu::ContextSupport* GetContextSupport();
129 129
130 gpu::gles2::GLES2Implementation* GetImplementation() { 130 gpu::gles2::GLES2Implementation* GetImplementation() {
131 return real_gl_.get(); 131 return real_gl_.get();
132 } 132 }
133 133
134 // Return true if GPU process reported context lost or there was a 134 // Return true if GPU process reported context lost or there was a
135 // problem communicating with the GPU process. 135 // problem communicating with the GPU process.
136 bool IsCommandBufferContextLost(); 136 bool IsCommandBufferContextLost();
137 137
138 // Create & initialize a WebGraphicsContext3DCommandBufferImpl. Return NULL 138 // Create & initialize a WebGraphicsContext3DCommandBufferImpl. Return NULL
139 // on any failure. 139 // on any failure.
140 static CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl* 140 static CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl*
141 CreateOffscreenContext( 141 CreateOffscreenContext(
142 GpuChannelHost* host, 142 gpu::GpuChannelHost* host,
143 const gpu::gles2::ContextCreationAttribHelper& attributes, 143 const gpu::gles2::ContextCreationAttribHelper& attributes,
144 gfx::GpuPreference gpu_preference, 144 gfx::GpuPreference gpu_preference,
145 bool share_resources, 145 bool share_resources,
146 bool automatic_flushes, 146 bool automatic_flushes,
147 const GURL& active_url, 147 const GURL& active_url,
148 const SharedMemoryLimits& limits, 148 const SharedMemoryLimits& limits,
149 WebGraphicsContext3DCommandBufferImpl* share_context); 149 WebGraphicsContext3DCommandBufferImpl* share_context);
150 150
151 size_t GetMappedMemoryLimit() { 151 size_t GetMappedMemoryLimit() {
152 return mem_limits_.mapped_memory_reclaim_limit; 152 return mem_limits_.mapped_memory_reclaim_limit;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // from fake NativeViewIds to PluginWindowHandles, but this seems like 190 // from fake NativeViewIds to PluginWindowHandles, but this seems like
191 // unnecessary complexity at the moment. 191 // unnecessary complexity at the moment.
192 bool CreateContext(); 192 bool CreateContext();
193 193
194 virtual void OnContextLost(); 194 virtual void OnContextLost();
195 195
196 bool automatic_flushes_; 196 bool automatic_flushes_;
197 gpu::gles2::ContextCreationAttribHelper attributes_; 197 gpu::gles2::ContextCreationAttribHelper attributes_;
198 198
199 // State needed by MaybeInitializeGL. 199 // State needed by MaybeInitializeGL.
200 scoped_refptr<GpuChannelHost> host_; 200 scoped_refptr<gpu::GpuChannelHost> host_;
201 gpu::SurfaceHandle surface_handle_; 201 gpu::SurfaceHandle surface_handle_;
202 GURL active_url_; 202 GURL active_url_;
203 CommandBufferContextType context_type_; 203 CommandBufferContextType context_type_;
204 204
205 gfx::GpuPreference gpu_preference_; 205 gfx::GpuPreference gpu_preference_;
206 206
207 scoped_ptr<CommandBufferProxyImpl> command_buffer_; 207 scoped_ptr<gpu::CommandBufferProxyImpl> command_buffer_;
208 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; 208 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
209 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; 209 scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
210 scoped_ptr<gpu::gles2::GLES2Implementation> real_gl_; 210 scoped_ptr<gpu::gles2::GLES2Implementation> real_gl_;
211 scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_; 211 scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_;
212 SharedMemoryLimits mem_limits_; 212 SharedMemoryLimits mem_limits_;
213 scoped_refptr<ShareGroup> share_group_; 213 scoped_refptr<ShareGroup> share_group_;
214 214
215 // Member variables should appear before the WeakPtrFactory, to ensure 215 // Member variables should appear before the WeakPtrFactory, to ensure
216 // that any WeakPtrs to Controller are invalidated before its members 216 // that any WeakPtrs to Controller are invalidated before its members
217 // variable's destructors are executed, rendering them invalid. 217 // variable's destructors are executed, rendering them invalid.
218 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_; 218 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_;
219 }; 219 };
220 220
221 } // namespace content 221 } // namespace content
222 222
223 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ 223 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698