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}