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 fb452fb4c9423ac6822cc3bf633598efb3fec00f..c70e5b49a756a0bbbb979d1e7495b1c7eecba657 100644 |
--- a/content/browser/compositor/browser_compositor_view_private_mac.mm |
+++ b/content/browser/compositor/browser_compositor_view_private_mac.mm |
@@ -13,6 +13,10 @@ |
#include "ui/base/cocoa/animation_utils.h" |
#include "ui/gl/scoped_cgl.h" |
+@interface CompositingIOSurfaceLayer(Private) |
+- (void)immediatelyForceDisplayAndAck; |
+@end |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// BrowserCompositorViewCocoa |
@@ -98,6 +102,13 @@ |
accelerated_latency_info_.insert(accelerated_latency_info_.end(), |
latency_info.begin(), latency_info.end()); |
+ // If the client that wanted to display this frame has disappeared, don't |
+ // bother creating the layers, just un-block the compositor and quit. |
+ if (!client_) { |
+ [self layerDidDrawFrame]; |
+ return; |
+ } |
+ |
// Disable the fade-in animation as the layer is added, removed, or resized. |
ScopedCAActionDisabler disabler; |
@@ -136,17 +147,16 @@ |
// 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( |
- 0, |
- 0, |
- [accelerated_layer_ iosurface]->dip_io_surface_size().width(), |
- [accelerated_layer_ iosurface]->dip_io_surface_size().height()); |
+ 0, |
+ 0, |
+ [accelerated_layer_ iosurface]->dip_io_surface_size().width(), |
+ [accelerated_layer_ iosurface]->dip_io_surface_size().height()); |
bool bounds_changed = !CGRectEqualToRect( |
new_layer_bounds, [accelerated_layer_ bounds]); |
[accelerated_layer_ setBounds:new_layer_bounds]; |
if (bounds_changed || |
(client_ && client_->BrowserCompositorShouldDrawImmediately())) { |
- [accelerated_layer_ setNeedsDisplay]; |
- [accelerated_layer_ displayIfNeeded]; |
+ [accelerated_layer_ immediatelyForceDisplayAndAck]; |
} |
// If there was a software layer or an old accelerated layer, remove it. |
@@ -166,6 +176,11 @@ |
if (!frame_data || !canvas) |
return; |
+ // If the client that requested frame has disappeared, quit immediately (no |
+ // acknowledgement is needed to un-block the software compositor). |
+ if (!client_) |
+ return; |
+ |
// If there is not a layer for software frames, create one. |
if (!software_layer_) { |
// Disable the fade-in animation as the layer is added. |