OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDERER_GL_CONTEXT_H_ | 9 #ifndef CONTENT_RENDERER_RENDERER_GL_CONTEXT_H_ |
10 #define CONTENT_RENDERER_RENDERER_GL_CONTEXT_H_ | 10 #define CONTENT_RENDERER_RENDERER_GL_CONTEXT_H_ |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // already in place. We could add more entry points and messages to | 84 // already in place. We could add more entry points and messages to |
85 // allocate both fake PluginWindowHandles and NativeViewIds and map | 85 // allocate both fake PluginWindowHandles and NativeViewIds and map |
86 // from fake NativeViewIds to PluginWindowHandles, but this seems like | 86 // from fake NativeViewIds to PluginWindowHandles, but this seems like |
87 // unnecessary complexity at the moment. | 87 // unnecessary complexity at the moment. |
88 // | 88 // |
89 // The render_view_id is currently also only used on Mac OS X. | 89 // The render_view_id is currently also only used on Mac OS X. |
90 // TODO(kbr): clean up the arguments to this function and make them | 90 // TODO(kbr): clean up the arguments to this function and make them |
91 // more cross-platform. | 91 // more cross-platform. |
92 static RendererGLContext* CreateViewContext( | 92 static RendererGLContext* CreateViewContext( |
93 GpuChannelHost* channel, | 93 GpuChannelHost* channel, |
| 94 gfx::PluginWindowHandle render_surface, |
94 int render_view_id, | 95 int render_view_id, |
95 const char* allowed_extensions, | 96 const char* allowed_extensions, |
96 const int32* attrib_list, | 97 const int32* attrib_list, |
97 const GURL& active_arl); | 98 const GURL& active_arl); |
98 | 99 |
99 #if defined(OS_MACOSX) | 100 #if defined(OS_MACOSX) |
100 // On Mac OS X only, view RendererGLContexts actually behave like offscreen | 101 // On Mac OS X only, view RendererGLContexts actually behave like offscreen |
101 // RendererGLContexts, and require an explicit resize operation which is | 102 // RendererGLContexts, and require an explicit resize operation which is |
102 // slightly different from that of offscreen RendererGLContexts. | 103 // slightly different from that of offscreen RendererGLContexts. |
103 void ResizeOnscreen(const gfx::Size& size); | 104 void ResizeOnscreen(const gfx::Size& size); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // for synchronization with parent context. If *this* context does not have a | 199 // for synchronization with parent context. If *this* context does not have a |
199 // parent context, these methods will return false. | 200 // parent context, these methods will return false. |
200 bool GetParentToChildLatch(uint32* parent_to_child_latch); | 201 bool GetParentToChildLatch(uint32* parent_to_child_latch); |
201 bool GetChildToParentLatch(uint32* child_to_parent_latch); | 202 bool GetChildToParentLatch(uint32* child_to_parent_latch); |
202 | 203 |
203 private: | 204 private: |
204 RendererGLContext(GpuChannelHost* channel, | 205 RendererGLContext(GpuChannelHost* channel, |
205 RendererGLContext* parent); | 206 RendererGLContext* parent); |
206 | 207 |
207 bool Initialize(bool onscreen, | 208 bool Initialize(bool onscreen, |
| 209 gfx::PluginWindowHandle render_surface, |
208 int render_view_id, | 210 int render_view_id, |
209 const gfx::Size& size, | 211 const gfx::Size& size, |
210 const char* allowed_extensions, | 212 const char* allowed_extensions, |
211 const int32* attrib_list, | 213 const int32* attrib_list, |
212 const GURL& active_url); | 214 const GURL& active_url); |
213 void Destroy(); | 215 void Destroy(); |
214 | 216 |
215 void OnSwapBuffers(); | 217 void OnSwapBuffers(); |
216 void OnContextLost(); | 218 void OnContextLost(); |
217 | 219 |
218 scoped_refptr<GpuChannelHost> channel_; | 220 scoped_refptr<GpuChannelHost> channel_; |
219 base::WeakPtr<RendererGLContext> parent_; | 221 base::WeakPtr<RendererGLContext> parent_; |
220 scoped_ptr<Callback0::Type> swap_buffers_callback_; | 222 scoped_ptr<Callback0::Type> swap_buffers_callback_; |
221 scoped_ptr<Callback0::Type> context_lost_callback_; | 223 scoped_ptr<Callback0::Type> context_lost_callback_; |
222 uint32 parent_texture_id_; | 224 uint32 parent_texture_id_; |
223 uint32 child_to_parent_latch_; | 225 uint32 child_to_parent_latch_; |
224 uint32 parent_to_child_latch_; | 226 uint32 parent_to_child_latch_; |
225 int32 latch_transfer_buffer_id_; | 227 int32 latch_transfer_buffer_id_; |
226 CommandBufferProxy* command_buffer_; | 228 CommandBufferProxy* command_buffer_; |
227 gpu::gles2::GLES2CmdHelper* gles2_helper_; | 229 gpu::gles2::GLES2CmdHelper* gles2_helper_; |
228 int32 transfer_buffer_id_; | 230 int32 transfer_buffer_id_; |
229 gpu::gles2::GLES2Implementation* gles2_implementation_; | 231 gpu::gles2::GLES2Implementation* gles2_implementation_; |
230 gfx::Size size_; | 232 gfx::Size size_; |
231 Error last_error_; | 233 Error last_error_; |
232 | 234 |
233 DISALLOW_COPY_AND_ASSIGN(RendererGLContext); | 235 DISALLOW_COPY_AND_ASSIGN(RendererGLContext); |
234 }; | 236 }; |
235 | 237 |
236 #endif // CONTENT_RENDERER_RENDERER_GL_CONTEXT_H_ | 238 #endif // CONTENT_RENDERER_RENDERER_GL_CONTEXT_H_ |
OLD | NEW |