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 8efa2589f1e9045fe8405065ffba84ad6a589fdc..35cee20155c840e8d07fc2c97f224269eda28046 100644 |
| --- a/content/browser/renderer_host/compositing_iosurface_layer_mac.mm |
| +++ b/content/browser/renderer_host/compositing_iosurface_layer_mac.mm |
| @@ -54,7 +54,7 @@ void CompositingIOSurfaceLayerHelper::GotNewFrame() { |
| // If reqested, draw immediately and don't bother trying to use the |
| // isAsynchronous property to ensure smooth animation. |
| if (client_->AcceleratedLayerShouldAckImmediately()) { |
| - ImmediatelyForceDisplayAndAck(); |
| + SetNeedsDisplayAndDisplayAndAck(); |
| } else { |
| if (![layer_ isAsynchronous]) |
| [layer_ setAsynchronous:YES]; |
| @@ -104,8 +104,29 @@ void CompositingIOSurfaceLayerHelper::AckPendingFrame(bool success) { |
| TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, 0); |
| } |
| -void CompositingIOSurfaceLayerHelper::ImmediatelyForceDisplayAndAck() { |
| +void CompositingIOSurfaceLayerHelper::SetNeedsDisplayAndDisplayAndAck() { |
| + // Drawing using setNeedsDisplay and displayIfNeeded will result in |
| + // subsequent canDrawInCGLContext callbacks getting dropped, and jerky |
| + // animation. Disable asynchronous drawing before issuing these calls as a |
| + // workaround. |
| + // http://crbug.com/395827 |
| + if ([layer_ isAsynchronous]) |
| + [layer_ setAsynchronous:NO]; |
|
Ken Russell (switch to Gerrit)
2014/07/22 19:52:04
I don't know the various state transitions done to
ccameron
2014/07/23 07:50:34
It gets re-set to asynchronous as soon as a new fr
|
| + |
| [layer_ setNeedsDisplay]; |
| + DisplayIfNeededAndAck(); |
| +} |
| + |
| +void CompositingIOSurfaceLayerHelper::DisplayIfNeededAndAck() { |
| + if (!needs_display_) |
| + return; |
| + |
| + // As in SetNeedsDisplayAndDisplayAndAck, disable asynchronous drawing before |
| + // issuing displayIfNeeded. |
| + // http://crbug.com/395827 |
| + if ([layer_ isAsynchronous]) |
| + [layer_ setAsynchronous:NO]; |
| + |
| [layer_ displayIfNeeded]; |
| // Calls to setNeedsDisplay can sometimes be ignored, especially if issued |
| @@ -116,7 +137,7 @@ void CompositingIOSurfaceLayerHelper::ImmediatelyForceDisplayAndAck() { |
| } |
| void CompositingIOSurfaceLayerHelper::TimerFired() { |
| - ImmediatelyForceDisplayAndAck(); |
| + SetNeedsDisplayAndDisplayAndAck(); |
| } |
| } // namespace content |
| @@ -171,6 +192,14 @@ void CompositingIOSurfaceLayerHelper::TimerFired() { |
| helper_->GotNewFrame(); |
| } |
| +- (void)setNeedsDisplayAndDisplayAndAck { |
| + helper_->SetNeedsDisplayAndDisplayAndAck(); |
| +} |
| + |
| +- (void)displayIfNeededAndAck { |
| + helper_->DisplayIfNeededAndAck(); |
| +} |
| + |
| // The remaining methods implement the CAOpenGLLayer interface. |
| - (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask { |