Chromium Code Reviews| Index: content/browser/renderer_host/compositing_iosurface_layer_mac.mm |
| diff --git a/content/browser/renderer_host/compositing_iosurface_layer_mac.mm b/content/browser/renderer_host/compositing_iosurface_layer_mac.mm |
| index 2f2068e036206867b0871d5cadec9b016ecd0121..212fd67a85dedabaa9bf2e475c927e4ae9eab1f4 100644 |
| --- a/content/browser/renderer_host/compositing_iosurface_layer_mac.mm |
| +++ b/content/browser/renderer_host/compositing_iosurface_layer_mac.mm |
| @@ -57,11 +57,23 @@ |
| } |
| - (void)gotNewFrame { |
| - if (![self isAsynchronous]) { |
| - [self setNeedsDisplay]; |
| - [self setAsynchronous:YES]; |
| - } else { |
| + if ([self isAsynchronous]) { |
| needsDisplay_ = YES; |
| + } else { |
| + // Calls to setNeedsDisplay can sometimes be ignored, especially if issued |
| + // rapidly (e.g, with vsync off). This is unacceptable because the failure |
| + // to ack a single frame will hang the renderer. Call setNeedsDisplay and |
| + // displayIfNeeded in a loop to ensure the call goes through. |
| + do { |
| + [self setNeedsDisplay]; |
| + [self displayIfNeeded]; |
| + } while (needsDisplay_); |
| + |
| + // If vsync is disabled, don't bother trying to use the isAsynchronous |
| + // property to ensure smooth animation. |
| + if (!context_ || !context_->is_vsync_disabled()) { |
| + [self setAsynchronous:YES]; |
| + } |
| } |
| } |
| @@ -70,8 +82,12 @@ |
| return; |
| [self setAsynchronous:NO]; |
| - if (needsDisplay_) |
| + |
| + // If there was a pending frame, ensure that it goes through. |
| + while (needsDisplay_) { |
| [self setNeedsDisplay]; |
| + [self displayIfNeeded]; |
| + } |
| } |
| - (void)waitForResizedFrameInContext:(CGLContextObj)glContext { |
| @@ -178,6 +194,11 @@ |
| needsDisplay_ = NO; |
| renderWidgetHostView_->SendPendingLatencyInfoToHost(); |
| + |
|
ccameron
2014/02/20 10:42:59
This is to match the behavior of WebKit. The claim
|
| + [super drawInCGLContext:glContext |
| + pixelFormat:pixelFormat |
| + forLayerTime:timeInterval |
| + displayTime:timeStamp]; |
| } |
| @end |