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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "content/common/gpu/gpu_process_launch_causes.h" | 14 #include "content/common/gpu/gpu_process_launch_causes.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
19 #include "ui/gl/gpu_preference.h" | 19 #include "ui/gl/gpu_preference.h" |
20 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
21 | 21 |
22 #if defined(USE_SKIA) | 22 #if defined(USE_SKIA) |
23 #define FLIP_FRAMEBUFFER_VERTICALLY | 23 #define FLIP_FRAMEBUFFER_VERTICALLY |
24 #endif | 24 #endif |
25 | 25 |
26 class CommandBufferProxy; | 26 class CommandBufferProxy; |
27 class GpuChannelHost; | |
28 class GpuChannelHostFactory; | |
29 struct GpuMemoryAllocationForRenderer; | |
30 | |
31 | |
32 namespace gpu { | 27 namespace gpu { |
33 | 28 |
34 class TransferBuffer; | 29 class TransferBuffer; |
35 | 30 |
36 namespace gles2 { | 31 namespace gles2 { |
37 class GLES2CmdHelper; | 32 class GLES2CmdHelper; |
38 class GLES2Implementation; | 33 class GLES2Implementation; |
39 } | 34 } |
40 } | 35 } |
41 | 36 |
42 using WebKit::WebGLId; | 37 using WebKit::WebGLId; |
43 | 38 |
44 using WebKit::WGC3Dbyte; | 39 using WebKit::WGC3Dbyte; |
45 using WebKit::WGC3Dchar; | 40 using WebKit::WGC3Dchar; |
46 using WebKit::WGC3Denum; | 41 using WebKit::WGC3Denum; |
47 using WebKit::WGC3Dboolean; | 42 using WebKit::WGC3Dboolean; |
48 using WebKit::WGC3Dbitfield; | 43 using WebKit::WGC3Dbitfield; |
49 using WebKit::WGC3Dint; | 44 using WebKit::WGC3Dint; |
50 using WebKit::WGC3Dsizei; | 45 using WebKit::WGC3Dsizei; |
51 using WebKit::WGC3Duint; | 46 using WebKit::WGC3Duint; |
52 using WebKit::WGC3Dfloat; | 47 using WebKit::WGC3Dfloat; |
53 using WebKit::WGC3Dclampf; | 48 using WebKit::WGC3Dclampf; |
54 using WebKit::WGC3Dintptr; | 49 using WebKit::WGC3Dintptr; |
55 using WebKit::WGC3Dsizeiptr; | 50 using WebKit::WGC3Dsizeiptr; |
56 | 51 |
| 52 namespace content { |
| 53 class GpuChannelHost; |
| 54 class GpuChannelHostFactory; |
| 55 struct GpuMemoryAllocationForRenderer; |
| 56 |
57 // TODO(piman): move this logic to the compositor and remove it from the | 57 // TODO(piman): move this logic to the compositor and remove it from the |
58 // context... | 58 // context... |
59 class WebGraphicsContext3DSwapBuffersClient { | 59 class WebGraphicsContext3DSwapBuffersClient { |
60 public: | 60 public: |
61 virtual void OnViewContextSwapBuffersPosted() = 0; | 61 virtual void OnViewContextSwapBuffersPosted() = 0; |
62 virtual void OnViewContextSwapBuffersComplete() = 0; | 62 virtual void OnViewContextSwapBuffersComplete() = 0; |
63 virtual void OnViewContextSwapBuffersAborted() = 0; | 63 virtual void OnViewContextSwapBuffersAborted() = 0; |
64 | 64 |
65 protected: | 65 protected: |
66 virtual ~WebGraphicsContext3DSwapBuffersClient() {} | 66 virtual ~WebGraphicsContext3DSwapBuffersClient() {} |
(...skipping 13 matching lines...) Expand all Loading... |
80 | 80 |
81 virtual ~WebGraphicsContext3DCommandBufferImpl(); | 81 virtual ~WebGraphicsContext3DCommandBufferImpl(); |
82 | 82 |
83 void InitializeWithCommandBuffer( | 83 void InitializeWithCommandBuffer( |
84 CommandBufferProxy* command_buffer, | 84 CommandBufferProxy* command_buffer, |
85 const Attributes& attributes, | 85 const Attributes& attributes, |
86 bool bind_generates_resources); | 86 bool bind_generates_resources); |
87 | 87 |
88 bool Initialize(const Attributes& attributes, | 88 bool Initialize(const Attributes& attributes, |
89 bool bind_generates_resources, | 89 bool bind_generates_resources, |
90 content::CauseForGpuLaunch cause); | 90 CauseForGpuLaunch cause); |
91 | 91 |
92 // The following 3 IDs let one uniquely identify this context. | 92 // The following 3 IDs let one uniquely identify this context. |
93 // Gets the GPU process ID for this context. | 93 // Gets the GPU process ID for this context. |
94 int GetGPUProcessID(); | 94 int GetGPUProcessID(); |
95 | 95 |
96 // Gets the channel ID for this context. | 96 // Gets the channel ID for this context. |
97 int GetChannelID(); | 97 int GetChannelID(); |
98 | 98 |
99 // Gets the context ID (relative to the channel). | 99 // Gets the context ID (relative to the channel). |
100 int GetContextID(); | 100 int GetContextID(); |
(...skipping 19 matching lines...) Expand all Loading... |
120 // allocate both fake PluginWindowHandles and NativeViewIds and map | 120 // allocate both fake PluginWindowHandles and NativeViewIds and map |
121 // from fake NativeViewIds to PluginWindowHandles, but this seems like | 121 // from fake NativeViewIds to PluginWindowHandles, but this seems like |
122 // unnecessary complexity at the moment. | 122 // unnecessary complexity at the moment. |
123 static WebGraphicsContext3DCommandBufferImpl* CreateViewContext( | 123 static WebGraphicsContext3DCommandBufferImpl* CreateViewContext( |
124 GpuChannelHostFactory* factory, | 124 GpuChannelHostFactory* factory, |
125 int32 surface_id, | 125 int32 surface_id, |
126 const char* allowed_extensions, | 126 const char* allowed_extensions, |
127 const WebGraphicsContext3D::Attributes& attributes, | 127 const WebGraphicsContext3D::Attributes& attributes, |
128 bool bind_generates_resources, | 128 bool bind_generates_resources, |
129 const GURL& active_url, | 129 const GURL& active_url, |
130 content::CauseForGpuLaunch cause); | 130 CauseForGpuLaunch cause); |
131 | 131 |
132 // Create & initialize a WebGraphicsContext3DCommandBufferImpl. Return NULL | 132 // Create & initialize a WebGraphicsContext3DCommandBufferImpl. Return NULL |
133 // on any failure. | 133 // on any failure. |
134 static WebGraphicsContext3DCommandBufferImpl* CreateOffscreenContext( | 134 static WebGraphicsContext3DCommandBufferImpl* CreateOffscreenContext( |
135 GpuChannelHostFactory* factory, | 135 GpuChannelHostFactory* factory, |
136 const WebGraphicsContext3D::Attributes& attributes, | 136 const WebGraphicsContext3D::Attributes& attributes, |
137 const GURL& active_url); | 137 const GURL& active_url); |
138 | 138 |
139 //---------------------------------------------------------------------- | 139 //---------------------------------------------------------------------- |
140 // WebGraphicsContext3D methods | 140 // WebGraphicsContext3D methods |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 CommandBufferProxy* command_buffer_; | 722 CommandBufferProxy* command_buffer_; |
723 gpu::gles2::GLES2CmdHelper* gles2_helper_; | 723 gpu::gles2::GLES2CmdHelper* gles2_helper_; |
724 gpu::TransferBuffer* transfer_buffer_; | 724 gpu::TransferBuffer* transfer_buffer_; |
725 gpu::gles2::GLES2Implementation* gl_; | 725 gpu::gles2::GLES2Implementation* gl_; |
726 Error last_error_; | 726 Error last_error_; |
727 int frame_number_; | 727 int frame_number_; |
728 bool bind_generates_resources_; | 728 bool bind_generates_resources_; |
729 bool use_echo_for_swap_ack_; | 729 bool use_echo_for_swap_ack_; |
730 }; | 730 }; |
731 | 731 |
| 732 } // namespace content |
| 733 |
732 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 734 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |