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..60d77176923db9b5352a55672f7bf373be2b449e 100644 |
| --- a/content/browser/renderer_host/compositing_iosurface_layer_mac.mm |
| +++ b/content/browser/renderer_host/compositing_iosurface_layer_mac.mm |
| @@ -57,11 +57,22 @@ |
| } |
| - (void)gotNewFrame { |
| - if (![self isAsynchronous]) { |
| + if (context_ && context_->is_vsync_disabled()) { |
| + // If vsync is disabled, draw immediately and don't bother trying to use |
| + // the isAsynchronous property to ensure smooth animation. |
| [self setNeedsDisplay]; |
| - [self setAsynchronous:YES]; |
| + [self displayIfNeeded]; |
| + |
| + // 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. Ensure that the renderer |
| + // not be blocked. |
| + if (needsDisplay_) |
| + renderWidgetHostView_->SendPendingSwapAck(); |
|
Ken Russell (switch to Gerrit)
2014/02/20 23:01:53
If we're mostly sending swap acks upon receiving n
ccameron
2014/02/21 00:48:23
CompositorSwapBuffers only does the ack if the fra
|
| } else { |
| needsDisplay_ = YES; |
| + if (![self isAsynchronous]) |
| + [self setAsynchronous:YES]; |
| } |
| } |
| @@ -70,8 +81,15 @@ |
| return; |
| [self setAsynchronous:NO]; |
| - if (needsDisplay_) |
| + |
| + // If there was a pending frame, ensure that it goes through. |
| + if (needsDisplay_) { |
| [self setNeedsDisplay]; |
| + [self displayIfNeeded]; |
| + } |
| + // If that fails then ensure that, at a minimum, the renderer is not blocked. |
| + if (needsDisplay_) |
| + renderWidgetHostView_->SendPendingSwapAck(); |
| } |
| - (void)waitForResizedFrameInContext:(CGLContextObj)glContext { |
| @@ -178,6 +196,11 @@ |
| needsDisplay_ = NO; |
| renderWidgetHostView_->SendPendingLatencyInfoToHost(); |
| + |
| + [super drawInCGLContext:glContext |
| + pixelFormat:pixelFormat |
| + forLayerTime:timeInterval |
| + displayTime:timeStamp]; |
| } |
| @end |