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 // This API is consistent with other OpenGL setup APIs like window's WGL | 5 // This API is consistent with other OpenGL setup APIs like window's WGL |
6 // and pepper's PGL. This API is used to manage OpenGL RendererGLContexts in the | 6 // and pepper's PGL. This API is used to manage OpenGL RendererGLContexts in the |
7 // Chrome renderer process in a way that is consistent with other platforms. | 7 // Chrome renderer process in a way that is consistent with other platforms. |
8 | 8 |
9 #ifndef CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ | 9 #ifndef CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ |
10 #define CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ | 10 #define CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // already in place. We could add more entry points and messages to | 96 // already in place. We could add more entry points and messages to |
97 // allocate both fake PluginWindowHandles and NativeViewIds and map | 97 // allocate both fake PluginWindowHandles and NativeViewIds and map |
98 // from fake NativeViewIds to PluginWindowHandles, but this seems like | 98 // from fake NativeViewIds to PluginWindowHandles, but this seems like |
99 // unnecessary complexity at the moment. | 99 // unnecessary complexity at the moment. |
100 // | 100 // |
101 // The render_view_id is currently also only used on Mac OS X. | 101 // The render_view_id is currently also only used on Mac OS X. |
102 // TODO(kbr): clean up the arguments to this function and make them | 102 // TODO(kbr): clean up the arguments to this function and make them |
103 // more cross-platform. | 103 // more cross-platform. |
104 static RendererGLContext* CreateViewContext( | 104 static RendererGLContext* CreateViewContext( |
105 GpuChannelHost* channel, | 105 GpuChannelHost* channel, |
106 int render_view_id, | 106 int32 surface_id, |
107 RendererGLContext* share_group, | 107 RendererGLContext* share_group, |
108 const char* allowed_extensions, | 108 const char* allowed_extensions, |
109 const int32* attrib_list, | 109 const int32* attrib_list, |
110 const GURL& active_url, | 110 const GURL& active_url, |
111 gfx::GpuPreference gpu_preference); | 111 gfx::GpuPreference gpu_preference); |
112 | 112 |
113 // Create a RendererGLContext that renders to an offscreen frame buffer. If | 113 // Create a RendererGLContext that renders to an offscreen frame buffer. If |
114 // parent is not NULL, that RendererGLContext can access a copy of the created | 114 // parent is not NULL, that RendererGLContext can access a copy of the created |
115 // RendererGLContext's frame buffer that is updated every time SwapBuffers is | 115 // RendererGLContext's frame buffer that is updated every time SwapBuffers is |
116 // called. It is not as general as shared RendererGLContexts in other | 116 // called. It is not as general as shared RendererGLContexts in other |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // Return true if GPU process reported RendererGLContext lost or there was a | 175 // Return true if GPU process reported RendererGLContext lost or there was a |
176 // problem communicating with the GPU process. | 176 // problem communicating with the GPU process. |
177 bool IsCommandBufferContextLost(); | 177 bool IsCommandBufferContextLost(); |
178 | 178 |
179 CommandBufferProxy* GetCommandBufferProxy(); | 179 CommandBufferProxy* GetCommandBufferProxy(); |
180 | 180 |
181 private: | 181 private: |
182 explicit RendererGLContext(GpuChannelHost* channel); | 182 explicit RendererGLContext(GpuChannelHost* channel); |
183 | 183 |
184 bool Initialize(bool onscreen, | 184 bool Initialize(bool onscreen, |
185 int render_view_id, | 185 int32 surface_id, |
186 const gfx::Size& size, | 186 const gfx::Size& size, |
187 RendererGLContext* share_group, | 187 RendererGLContext* share_group, |
188 const char* allowed_extensions, | 188 const char* allowed_extensions, |
189 const int32* attrib_list, | 189 const int32* attrib_list, |
190 const GURL& active_url, | 190 const GURL& active_url, |
191 gfx::GpuPreference gpu_preference); | 191 gfx::GpuPreference gpu_preference); |
192 void Destroy(); | 192 void Destroy(); |
193 | 193 |
194 void OnContextLost(); | 194 void OnContextLost(); |
195 | 195 |
196 scoped_refptr<GpuChannelHost> channel_; | 196 scoped_refptr<GpuChannelHost> channel_; |
197 base::WeakPtr<RendererGLContext> parent_; | 197 base::WeakPtr<RendererGLContext> parent_; |
198 base::Callback<void(ContextLostReason)> context_lost_callback_; | 198 base::Callback<void(ContextLostReason)> context_lost_callback_; |
199 uint32 parent_texture_id_; | 199 uint32 parent_texture_id_; |
200 CommandBufferProxy* command_buffer_; | 200 CommandBufferProxy* command_buffer_; |
201 gpu::gles2::GLES2CmdHelper* gles2_helper_; | 201 gpu::gles2::GLES2CmdHelper* gles2_helper_; |
202 int32 transfer_buffer_id_; | 202 int32 transfer_buffer_id_; |
203 gpu::gles2::GLES2Implementation* gles2_implementation_; | 203 gpu::gles2::GLES2Implementation* gles2_implementation_; |
204 Error last_error_; | 204 Error last_error_; |
205 int frame_number_; | 205 int frame_number_; |
206 | 206 |
207 DISALLOW_COPY_AND_ASSIGN(RendererGLContext); | 207 DISALLOW_COPY_AND_ASSIGN(RendererGLContext); |
208 }; | 208 }; |
209 | 209 |
210 #endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ | 210 #endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ |
OLD | NEW |