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

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 matching loops 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..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

Powered by Google App Engine
This is Rietveld 408576698