Index: content/browser/renderer_host/render_widget_host_view_mac.mm |
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm |
index 31d9caf5bca0d1cd206dbed13859cbc65499da46..eb09219b45edf5fca070ad8dea618c17fe9515bd 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm |
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm |
@@ -1363,13 +1363,15 @@ void RenderWidgetHostViewMac::CompositorSwapBuffers( |
// Make the context current and update the IOSurface with the handle |
// passed in by the swap command. |
- gfx::ScopedCGLSetCurrentContext scoped_set_current_context( |
- compositing_iosurface_context_->cgl_context()); |
- if (!compositing_iosurface_->SetIOSurfaceWithContextCurrent( |
- compositing_iosurface_context_, surface_handle, size, |
- surface_scale_factor)) { |
- LOG(ERROR) << "Failed SetIOSurface on CompositingIOSurfaceMac"; |
- return; |
+ { |
+ gfx::ScopedCGLSetCurrentContext scoped_set_current_context( |
+ compositing_iosurface_context_->cgl_context()); |
+ if (!compositing_iosurface_->SetIOSurfaceWithContextCurrent( |
+ compositing_iosurface_context_, surface_handle, size, |
+ surface_scale_factor)) { |
+ LOG(ERROR) << "Failed SetIOSurface on CompositingIOSurfaceMac"; |
+ return; |
+ } |
} |
// Grab video frames now that the IOSurface has been set up. Note that this |
@@ -1384,12 +1386,14 @@ void RenderWidgetHostViewMac::CompositorSwapBuffers( |
&frame, &callback)) { |
// Flush the context that updated the IOSurface, to ensure that the |
// context that does the copy picks up the correct version. |
- glFlush(); |
+ { |
+ gfx::ScopedCGLSetCurrentContext scoped_set_current_context( |
+ compositing_iosurface_context_->cgl_context()); |
+ glFlush(); |
+ } |
compositing_iosurface_->CopyToVideoFrame( |
gfx::Rect(size), frame, |
base::Bind(callback, present_time)); |
- DCHECK_EQ(CGLGetCurrentContext(), |
- compositing_iosurface_context_->cgl_context()); |
frame_was_captured = true; |
} |
} |
@@ -1447,6 +1451,8 @@ void RenderWidgetHostViewMac::CompositorSwapBuffers( |
compositing_iosurface_layer_async_timer_.Reset(); |
[compositing_iosurface_layer_ gotNewFrame]; |
} else { |
+ gfx::ScopedCGLSetCurrentContext scoped_set_current_context( |
+ compositing_iosurface_context_->cgl_context()); |
DrawIOSurfaceWithoutCoreAnimation(); |
} |