Mac NSCGLSurface: Wait until CALayer is committed to ack frames
commit4e6190e6239fac9078171c1cd0f7bd98618794d4
authorccameron <ccameron@chromium.org>
Wed, 1 Jul 2015 18:29:41 +0000 (1 11:29 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 1 Jul 2015 18:30:13 +0000 (1 18:30 +0000)
tree4eebc96d72f7bf19bc1410312cb20c12ab98dc3a
parent3a857db66445868136c1b6daa7618581eb7a2b0f
Mac NSCGLSurface: Wait until CALayer is committed to ack frames

Do not push new content to the image transport CALayer until the
previous content' -[CALayer _didCommitLayer] call is issued. If we
do not wait until that callback, then frames may be excessively
skipped, particularly under higher GPU load (e.g, with GPU rasterization
enabled).

Because the NSCGLSurface path now does not unblock the browser
immediately, make the already-existing mechanisms for ensuring that
the browser is eventually unblocked apply to NSCGLSurface as well.

In the process, factor out the code to create the appropriate CALayer
into CreateLayerAndRequestDraw. Also separate out unblocking the
browser from drawing, into LayerUnblockBrowserIfNeeded (because
now the NSCGLSurface will draw without immediately acking).

This behavior is not documented, and relies on empirically observed
and reverse-engineered behavior. The seemingly similar public APIs
(e.g, -[CATransaction setCompletionBlock:]) do not have the desired
effect.

BUG=505919

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

Cr-Commit-Position: refs/heads/master@{#337074}
content/common/gpu/image_transport_surface_calayer_mac.h
content/common/gpu/image_transport_surface_calayer_mac.mm