SkiaRenderer/macOS: Use IOSurfaceInUse to not recycle in-use resources

Add a method GLImage::IsInUseByWindowServer. This is implemented
only macOS, and queries the IOSurfaceIsInUse method. Roll the
the function GLImageIOSurface::CanCheckIOSurfaceIsInUse into the
GLImageIOSurface::IsInUseByWindowServer function.

Add two accessors to viz::OutputPresenter::OverlayData. One is
IsInUseByWindowServer (which calls the method on the GLImage).
The second returns the mailbox for the the overlay.

Add viz::SkiaOutputDeviceBufferQueue::in_use_by_window_server_overlays_,
which is a map from gpu::Mailbox to viz::OutputPresenter::OverlayData.
When overlays are swapped in SkiaOutputDeviceBufferQueue::
DoFinishSwapBuffers, move them into this map, and remove any entries
that are no longer in use.

Bug: 1100750
Change-Id: I32ccc4aee6e0392e258bc03086f70f06a5b2bdc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274776
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: Peng Huang <penghuang@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#786918}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e7d4874c0220d1cad5aaeb047a40a6e92e133af0
2 files changed