Commit 8a33b058 authored by ccameron@chromium.org's avatar ccameron@chromium.org

CoreAnimation: Ensure frames are acked when tab capture is enabled

If tab capture is enabled, but the window that is being displayed is
occluded, then the quality of the broadcast may be negatively impacted
by throttling of its presentation.

To avoid this, disable throttling the presentation of the windows that
are occluded but may be being captured.

Do not disable throttling for non-occluded windows, because that will
result in the renderer overloading the browser, and frames being dropped
by the browser, resulting in unsmooth animation.

BUG=350410

Review URL: https://codereview.chromium.org/279523003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269642 0039d316-1c4b-4281-b951-d872f2087c98
parent ef3adfcc
......@@ -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());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment