Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc

Issue 7762013: Added GPU process "echo" IPC message. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" 7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h"
8 8
9 #include "gpu/GLES2/gl2.h" 9 #include "gpu/GLES2/gl2.h"
10 #ifndef GL_GLEXT_PROTOTYPES 10 #ifndef GL_GLEXT_PROTOTYPES
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 web_view_(NULL), 42 web_view_(NULL),
43 #endif 43 #endif
44 #if defined(OS_MACOSX) 44 #if defined(OS_MACOSX)
45 plugin_handle_(NULL), 45 plugin_handle_(NULL),
46 #endif // defined(OS_MACOSX) 46 #endif // defined(OS_MACOSX)
47 context_lost_callback_(0), 47 context_lost_callback_(0),
48 context_lost_reason_(GL_NO_ERROR), 48 context_lost_reason_(GL_NO_ERROR),
49 swapbuffers_complete_callback_(0), 49 swapbuffers_complete_callback_(0),
50 cached_width_(0), 50 cached_width_(0),
51 cached_height_(0), 51 cached_height_(0),
52 bound_fbo_(0) { 52 bound_fbo_(0),
53 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
53 } 54 }
54 55
55 WebGraphicsContext3DCommandBufferImpl:: 56 WebGraphicsContext3DCommandBufferImpl::
56 ~WebGraphicsContext3DCommandBufferImpl() { 57 ~WebGraphicsContext3DCommandBufferImpl() {
57 g_all_shared_contexts.Pointer()->erase(this); 58 g_all_shared_contexts.Pointer()->erase(this);
58 delete context_; 59 delete context_;
59 } 60 }
60 61
61 // This string should only be passed for WebGL contexts. Nothing ELSE!!! 62 // This string should only be passed for WebGL contexts. Nothing ELSE!!!
62 // Compositor contexts, Canvas2D contexts, Pepper Contexts, nor any other use of 63 // Compositor contexts, Canvas2D contexts, Pepper Contexts, nor any other use of
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return false; 131 return false;
131 web_view_ = web_view; 132 web_view_ = web_view;
132 #endif 133 #endif
133 context_ = RendererGLContext::CreateViewContext( 134 context_ = RendererGLContext::CreateViewContext(
134 host, 135 host,
135 renderview->routing_id(), 136 renderview->routing_id(),
136 share_group, 137 share_group,
137 preferred_extensions, 138 preferred_extensions,
138 attribs, 139 attribs,
139 active_url); 140 active_url);
140 if (context_) {
141 context_->SetSwapBuffersCallback(
142 NewCallback(this,
143 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete));
144 }
145 } else { 141 } else {
146 context_ = RendererGLContext::CreateOffscreenContext( 142 context_ = RendererGLContext::CreateOffscreenContext(
147 host, 143 host,
148 gfx::Size(1, 1), 144 gfx::Size(1, 1),
149 share_group, 145 share_group,
150 preferred_extensions, 146 preferred_extensions,
151 attribs, 147 attribs,
152 active_url); 148 active_url);
153 #ifndef WTF_USE_THREADED_COMPOSITING 149 #ifndef WTF_USE_THREADED_COMPOSITING
154 web_view_ = NULL; 150 web_view_ = NULL;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 void WebGraphicsContext3DCommandBufferImpl::prepareTexture() { 219 void WebGraphicsContext3DCommandBufferImpl::prepareTexture() {
224 // Copies the contents of the off-screen render target into the texture 220 // Copies the contents of the off-screen render target into the texture
225 // used by the compositor. 221 // used by the compositor.
226 #ifndef WTF_USE_THREADED_COMPOSITING 222 #ifndef WTF_USE_THREADED_COMPOSITING
227 RenderView* renderview = 223 RenderView* renderview =
228 web_view_ ? RenderView::FromWebView(web_view_) : NULL; 224 web_view_ ? RenderView::FromWebView(web_view_) : NULL;
229 if (renderview) 225 if (renderview)
230 renderview->OnViewContextSwapBuffersPosted(); 226 renderview->OnViewContextSwapBuffersPosted();
231 #endif 227 #endif
232 context_->SwapBuffers(); 228 context_->SwapBuffers();
229 context_->Echo(method_factory_.NewRunnableMethod(
230 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete));
233 #if defined(OS_MACOSX) 231 #if defined(OS_MACOSX)
234 // It appears that making the compositor's on-screen context current on 232 // It appears that making the compositor's on-screen context current on
235 // other platforms implies this flush. TODO(kbr): this means that the 233 // other platforms implies this flush. TODO(kbr): this means that the
236 // TOUCH build and, in the future, other platforms might need this. 234 // TOUCH build and, in the future, other platforms might need this.
237 gl_->Flush(); 235 gl_->Flush();
238 #endif 236 #endif
239 } 237 }
240 238
241 void WebGraphicsContext3DCommandBufferImpl::reshape(int width, int height) { 239 void WebGraphicsContext3DCommandBufferImpl::reshape(int width, int height) {
242 cached_width_ = width; 240 cached_width_ = width;
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 } 1064 }
1067 #ifndef WTF_USE_THREADED_COMPOSITING 1065 #ifndef WTF_USE_THREADED_COMPOSITING
1068 RenderView* renderview = 1066 RenderView* renderview =
1069 web_view_ ? RenderView::FromWebView(web_view_) : NULL; 1067 web_view_ ? RenderView::FromWebView(web_view_) : NULL;
1070 if (renderview) 1068 if (renderview)
1071 renderview->OnViewContextSwapBuffersAborted(); 1069 renderview->OnViewContextSwapBuffersAborted();
1072 #endif 1070 #endif
1073 } 1071 }
1074 1072
1075 #endif // defined(ENABLE_GPU) 1073 #endif // defined(ENABLE_GPU)
OLDNEW
« no previous file with comments | « content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h ('k') | content/renderer/pepper_platform_context_3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698