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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 216733002: Reduce the scope of CGL current contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698