RemoteMacViews: Replace IOSurface with CAContext in gfx::CALayerParams

A gfx::CALayerParams may pass the content to be drawn across processes via
either an IOSurface (sent as mach port) or a CAContextID (which is an
integer).

For historical reasons (software compositing output surfaces used to be
based in the browser process), software compositing uses IOSurfaces
instead of CAContextIDs.

The mojo connection to the app shim process does not support sending mach
ports, which results in nothing being drawn when using software compositing.

To work around this issue, add a IOSurfaceToRemoteLayerInterceptor that
inspects the gfx::CALayerParameters before they are sent from
BridgedNativeWidgetHost to its BridgedNativeWidget, and re-packages the
IOSurface as a CAContextID on the fly.

Restrict this workaround to only be applied when the BridgedNativeWidget
is out-of-process (that is, when using a PWA) to avoid unforeseen
consequences impacting release branches.

Bug: 942213
Change-Id: I30ff907e62d9d4c9416bfde9771529a13e012600
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1525625
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: ccameron <ccameron@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641130}
3 files changed