OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | |
6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | |
7 | |
8 #include <stddef.h> | |
9 #include <stdint.h> | |
10 | |
11 #include <memory> | |
12 #include <string> | |
13 #include <vector> | |
14 | |
15 #include "base/callback.h" | |
16 #include "base/macros.h" | |
17 #include "base/memory/ref_counted.h" | |
18 #include "base/memory/weak_ptr.h" | |
19 #include "base/synchronization/lock.h" | |
20 #include "content/common/content_export.h" | |
21 #include "content/common/gpu/client/command_buffer_metrics.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" | |
25 #include "third_party/WebKit/public/platform/WebString.h" | |
26 #include "ui/gl/gpu_preference.h" | |
27 #include "url/gurl.h" | |
28 | |
29 namespace gpu { | |
30 | |
31 class ContextSupport; | |
32 class GpuChannelHost; | |
33 struct SharedMemoryLimits; | |
34 class TransferBuffer; | |
35 | |
36 namespace gles2 { | |
37 class GLES2CmdHelper; | |
38 class GLES2Implementation; | |
39 class GLES2Interface; | |
40 class ShareGroup; | |
41 } | |
42 } | |
43 | |
44 namespace content { | |
45 | |
46 class WebGraphicsContext3DCommandBufferImpl { | |
47 public: | |
48 enum MappedMemoryReclaimLimit { | |
49 kNoLimit = 0, | |
50 }; | |
51 | |
52 // If surface_handle is not kNullSurfaceHandle, this creates a | |
53 // CommandBufferProxy that renders directly to a view. The view and | |
54 // the associated window must not be destroyed until the returned | |
55 // CommandBufferProxy has been destroyed, otherwise the GPU process might | |
56 // attempt to render to an invalid window handle. | |
57 CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl(); | |
58 CONTENT_EXPORT ~WebGraphicsContext3DCommandBufferImpl(); | |
59 | |
60 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() { | |
61 return command_buffer_.get(); | |
62 } | |
63 | |
64 gpu::gles2::GLES2Implementation* GetImplementation() { | |
65 return real_gl_.get(); | |
66 } | |
67 | |
68 CONTENT_EXPORT bool InitializeOnCurrentThread( | |
69 gpu::SurfaceHandle surface_handle, | |
70 const GURL& active_url, | |
71 gpu::GpuChannelHost* host, | |
72 gfx::GpuPreference gpu_preference, | |
73 bool automatic_flushes, | |
74 const gpu::SharedMemoryLimits& memory_limits, | |
75 gpu::CommandBufferProxyImpl* shared_command_buffer, | |
76 scoped_refptr<gpu::gles2::ShareGroup> share_group, | |
77 const gpu::gles2::ContextCreationAttribHelper& attributes, | |
78 command_buffer_metrics::ContextType context_type); | |
79 | |
80 private: | |
81 bool MaybeInitializeGL( | |
82 gpu::SurfaceHandle surface_handle, | |
83 const GURL& active_url, | |
84 gpu::GpuChannelHost* host, | |
85 gfx::GpuPreference gpu_preference, | |
86 bool automatic_flushes, | |
87 const gpu::SharedMemoryLimits& memory_limits, | |
88 gpu::CommandBufferProxyImpl* shared_command_buffer, | |
89 scoped_refptr<gpu::gles2::ShareGroup> share_group, | |
90 const gpu::gles2::ContextCreationAttribHelper& attributes, | |
91 command_buffer_metrics::ContextType context_type); | |
92 | |
93 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | |
94 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | |
95 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; | |
96 std::unique_ptr<gpu::gles2::GLES2Implementation> real_gl_; | |
97 std::unique_ptr<gpu::gles2::GLES2Interface> trace_gl_; | |
98 }; | |
99 | |
100 } // namespace content | |
101 | |
102 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | |
OLD | NEW |