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/client/command_buffer_proxy_impl.h" |
14 #include "content/common/gpu/gpu_process_launch_causes.h" | 15 #include "content/common/gpu/gpu_process_launch_causes.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
19 #include "ui/gl/gpu_preference.h" | 20 #include "ui/gl/gpu_preference.h" |
20 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
21 | 22 |
22 #if defined(USE_SKIA) | 23 #if defined(USE_SKIA) |
23 #define FLIP_FRAMEBUFFER_VERTICALLY | 24 #define FLIP_FRAMEBUFFER_VERTICALLY |
24 #endif | 25 #endif |
25 | 26 |
26 class CommandBufferProxy; | |
27 namespace gpu { | 27 namespace gpu { |
28 | 28 |
29 class TransferBuffer; | 29 class TransferBuffer; |
30 | 30 |
31 namespace gles2 { | 31 namespace gles2 { |
32 class GLES2CmdHelper; | 32 class GLES2CmdHelper; |
33 class GLES2Implementation; | 33 class GLES2Implementation; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 public: | 74 public: |
75 WebGraphicsContext3DCommandBufferImpl( | 75 WebGraphicsContext3DCommandBufferImpl( |
76 int surface_id, | 76 int surface_id, |
77 const GURL& active_url, | 77 const GURL& active_url, |
78 GpuChannelHostFactory* factory, | 78 GpuChannelHostFactory* factory, |
79 const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client); | 79 const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client); |
80 | 80 |
81 virtual ~WebGraphicsContext3DCommandBufferImpl(); | 81 virtual ~WebGraphicsContext3DCommandBufferImpl(); |
82 | 82 |
83 void InitializeWithCommandBuffer( | 83 void InitializeWithCommandBuffer( |
84 CommandBufferProxy* command_buffer, | 84 CommandBufferProxyImpl* 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 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(); |
101 | 101 |
102 CommandBufferProxy* GetCommandBufferProxy() { return command_buffer_; } | 102 CommandBufferProxyImpl* GetCommandBufferProxy() { return command_buffer_; } |
103 | 103 |
104 gpu::gles2::GLES2Implementation* GetImplementation() { return gl_; } | 104 gpu::gles2::GLES2Implementation* GetImplementation() { return gl_; } |
105 | 105 |
106 // Return true if GPU process reported context lost or there was a | 106 // Return true if GPU process reported context lost or there was a |
107 // problem communicating with the GPU process. | 107 // problem communicating with the GPU process. |
108 bool IsCommandBufferContextLost(); | 108 bool IsCommandBufferContextLost(); |
109 | 109 |
110 // Create a WebGraphicsContext3DCommandBufferImpl that renders directly to a | 110 // Create a WebGraphicsContext3DCommandBufferImpl that renders directly to a |
111 // view. The view and the associated window must not be destroyed until | 111 // view. The view and the associated window must not be destroyed until |
112 // the returned ContentGLContext has been destroyed, otherwise the GPU process | 112 // the returned ContentGLContext has been destroyed, otherwise the GPU process |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | 712 #ifdef FLIP_FRAMEBUFFER_VERTICALLY |
713 std::vector<uint8> scanline_; | 713 std::vector<uint8> scanline_; |
714 void FlipVertically(uint8* framebuffer, | 714 void FlipVertically(uint8* framebuffer, |
715 unsigned int width, | 715 unsigned int width, |
716 unsigned int height); | 716 unsigned int height); |
717 #endif | 717 #endif |
718 | 718 |
719 bool initialized_; | 719 bool initialized_; |
720 WebGraphicsContext3DCommandBufferImpl* parent_; | 720 WebGraphicsContext3DCommandBufferImpl* parent_; |
721 uint32 parent_texture_id_; | 721 uint32 parent_texture_id_; |
722 CommandBufferProxy* command_buffer_; | 722 CommandBufferProxyImpl* 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 | 732 } // namespace content |
733 | 733 |
734 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 734 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |