Mac Remote CoreAnimation: Fix flashing at tab-switch
commitefe98cde867c6fd51c1d897a2064add4233ebf8a
authorccameron <ccameron@chromium.org>
Wed, 19 Nov 2014 20:25:20 +0000 (19 12:25 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 19 Nov 2014 20:25:44 +0000 (19 20:25 +0000)
tree40b997218962375fdfc12389bacea7921f76ac14
parent2b53a6ca22c88d9817a97e77fac1917e4776d397
Mac Remote CoreAnimation: Fix flashing at tab-switch

When a CAContext is freed in the GPU process, its content will
immediately disappear in the browser process. This happens even if the
browser process is triggering this inside a NSDisableScreenUpdates
block. The result is that during a tab switch, the
RenderWidgetHostViewCocoa of the old tab is briefly flashed on screen
(this was determined by setting the hosted CALayer for the
RenderWidgetHostViewCocoas to different solid colors).

To avoid this, always keep a reference to old CAContexts that were
discarded for a fixed number of frames (2 new frames, or at least 3 acks
determined empirically to be enough) before discarding them. This gives
enough time for them to be flushed out by the browser.

BUG=425819

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

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