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

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

Issue 279523003: CoreAnimation: Ensure frames are acked when tab capture is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 2e89069f8921a6a50058307ebd33f37c9f5ea571..a4ae9c6580ba7da5c6cd4950e0c0b638ccb6b336 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -108,6 +108,20 @@ static NSString* const NSWindowDidChangeBackingPropertiesNotification =
#endif // 10.7
+// Declare things that are part of the 10.9 SDK.
+#if !defined(MAC_OS_X_VERSION_10_9) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
+enum {
+ NSWindowOcclusionStateVisible = 1UL << 1,
+};
+typedef NSUInteger NSWindowOcclusionState;
+
+@interface NSWindow (MavericksAPI)
+- (NSWindowOcclusionState)occlusionState;
+@end
+
+#endif // 10.9
+
// This method will return YES for OS X versions 10.7.3 and later, and NO
// otherwise.
// Used to prevent a crash when building with the 10.7 SDK and accessing the
@@ -1433,6 +1447,20 @@ void RenderWidgetHostViewMac::CompositorSwapBuffers(
return;
}
+ // If the window is occluded, then this frame's display call may be severely
+ // throttled. This is a good thing, unless tab capture may be active,
+ // because the broadcast will be inappropriately throttled.
+ // http://crbug.com/350410
+ NSWindow* window = [cocoa_view_ window];
+ if (window && [window respondsToSelector:@selector(occlusionState)]) {
+ bool window_is_occluded =
+ !([window occlusionState] & NSWindowOcclusionStateVisible);
+ // Note that we aggressively ack even if this particular frame is not being
+ // captured.
+ if (window_is_occluded && frame_subscriber_)
+ scoped_ack.Reset();
+ }
+
// If we reach here, then the frame will be displayed by a future draw
// call, so don't make the callback.
ignore_result(scoped_ack.Release());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698