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

Side by Side Diff: chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc

Issue 6099015: Fix swapbuffers callback crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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
« no previous file with comments | « chrome/renderer/webgraphicscontext3d_command_buffer_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" 7 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #ifndef GL_GLEXT_PROTOTYPES 10 #ifndef GL_GLEXT_PROTOTYPES
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 web_view_ = web_view; 112 web_view_ = web_view;
113 context_ = ggl::CreateViewContext( 113 context_ = ggl::CreateViewContext(
114 host, 114 host,
115 view_id, 115 view_id,
116 renderview->routing_id(), 116 renderview->routing_id(),
117 kWebGraphicsContext3DPerferredGLExtensions, 117 kWebGraphicsContext3DPerferredGLExtensions,
118 attribs); 118 attribs);
119 if (context_) { 119 if (context_) {
120 ggl::SetSwapBuffersCallback( 120 ggl::SetSwapBuffersCallback(
121 context_, 121 context_,
122 NewCallback(renderview, &RenderView::DidFlushPaint)); 122 NewCallback(this,
123 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffers));
123 } 124 }
124 } else { 125 } else {
125 bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( 126 bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch(
126 switches::kDisableAcceleratedCompositing); 127 switches::kDisableAcceleratedCompositing);
127 ggl::Context* parent_context = NULL; 128 ggl::Context* parent_context = NULL;
128 // If GPU compositing is enabled we need to create a GL context that shares 129 // If GPU compositing is enabled we need to create a GL context that shares
129 // resources with the compositor's context. 130 // resources with the compositor's context.
130 if (compositing_enabled) { 131 if (compositing_enabled) {
131 // Asking for the WebGraphicsContext3D on the WebView will force one to 132 // Asking for the WebGraphicsContext3D on the WebView will force one to
132 // be created if it doesn't already exist. When the compositor is created 133 // be created if it doesn't already exist. When the compositor is created
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 glDeleteTextures(1, &texture); 1027 glDeleteTextures(1, &texture);
1027 } 1028 }
1028 1029
1029 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( 1030 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor(
1030 unsigned texture, unsigned parentTexture) { 1031 unsigned texture, unsigned parentTexture) {
1031 makeContextCurrent(); 1032 makeContextCurrent();
1032 glCopyTextureToParentTextureCHROMIUM(texture, parentTexture); 1033 glCopyTextureToParentTextureCHROMIUM(texture, parentTexture);
1033 glFlush(); 1034 glFlush();
1034 } 1035 }
1035 1036
1037 void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffers() {
1038 // This may be called after tear-down of the RenderView.
1039 RenderView* renderview =
1040 web_view_ ? RenderView::FromWebView(web_view_) : NULL;
1041 if (renderview)
1042 renderview->DidFlushPaint();
1043 }
1044
1036 #endif // defined(ENABLE_GPU) 1045 #endif // defined(ENABLE_GPU)
OLDNEW
« no previous file with comments | « chrome/renderer/webgraphicscontext3d_command_buffer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698