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()); |