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}