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

Unified Diff: content/browser/renderer_host/compositing_iosurface_layer_mac.mm

Issue 171513012: Make --disable-gpu-vsync work with CoreAnimation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add swap ack scoped runner fix Created 6 years, 10 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
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

Powered by Google App Engine
This is Rietveld 408576698