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

Unified Diff: content/browser/compositor/browser_compositor_view_private_mac.mm

Issue 528403002: Revert of Simplify IOSurface CoreAnimation code: Part 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/compositor/io_surface_layer_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/browser_compositor_view_private_mac.mm
diff --git a/content/browser/compositor/browser_compositor_view_private_mac.mm b/content/browser/compositor/browser_compositor_view_private_mac.mm
index b89c6ee23731badfaacecf98f247303e23ad92ad..913b4b093be83ff8b165874af1f50ad4e3dac7c1 100644
--- a/content/browser/compositor/browser_compositor_view_private_mac.mm
+++ b/content/browser/compositor/browser_compositor_view_private_mac.mm
@@ -208,6 +208,7 @@
// layer.
bool needs_new_layer =
!io_surface_layer_ ||
+ [io_surface_layer_ hasBeenPoisoned] ||
[io_surface_layer_ scaleFactor] != scale_factor;
if (needs_new_layer) {
io_surface_layer_.reset(
@@ -220,12 +221,28 @@
}
// Open the provided IOSurface.
- [io_surface_layer_ gotFrameWithIOSurface:io_surface_id
- withPixelSize:pixel_size
- withScaleFactor:scale_factor];
+ if (io_surface_layer_) {
+ bool result = [io_surface_layer_ gotFrameWithIOSurface:io_surface_id
+ withPixelSize:pixel_size
+ withScaleFactor:scale_factor];
+ if (!result) {
+ DestroyIOSurfaceLayer(io_surface_layer_);
+ LOG(ERROR) << "Failed open IOSurface in IOSurfaceLayer";
+ }
+ }
+
+ // Give a final complaint if anything with the layer's creation went wrong.
+ // This frame will appear blank, the compositor will try to create another,
+ // and maybe that will go better.
+ if (!io_surface_layer_) {
+ LOG(ERROR) << "IOSurfaceLayer is nil, tab will be blank";
+ IOSurfaceLayerHitError();
+ }
// Make the CALayer draw and set its size appropriately.
if (io_surface_layer_) {
+ [io_surface_layer_ gotNewFrame];
+
// Set the bounds of the accelerated layer to match the size of the frame.
// If the bounds changed, force the content to be displayed immediately.
CGRect new_layer_bounds = CGRectMake(
@@ -328,8 +345,12 @@
}
void BrowserCompositorViewMacInternal::IOSurfaceLayerHitError() {
+ // Perform all acks that would have been done if the frame had succeeded, to
+ // un-block the compositor and renderer.
+ IOSurfaceLayerDidDrawFrame();
+
// Poison the context being used and request a mulligan.
- DestroyIOSurfaceLayer(io_surface_layer_);
+ [io_surface_layer_ poisonContextAndSharegroup];
compositor_->ScheduleFullRedraw();
}
« no previous file with comments | « no previous file | content/browser/compositor/io_surface_layer_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698