[go: nahoru, domu]

Move ownership of MojoFrameSinkManager out of FrameSinkManagerHost.

FrameSinkManagerHost is meant to be held in the Browser process to
give friendly C++ access over mojo to the FrameSinkManager
implementation (which is MojoFrameSinkManager).

Currently the FrameSinkManager is in the Browser too, but we want to
be able to move it, at which point FrameSinkManagerHost can no longer
own it. So we move it out to GpuProcessTransportFactory which will
be able to optionally own it when the display compositor is in the
browser process.

Since the ImageTransportFactory now needs a MessageLoop, we must
create one in RenderViewHostTestEnabler, but that collides with the
TestBrowserThreadBundle in many tests. So, we make it only create a
MessageLoop if one doesn't already exist, and we adjust construction
ordering in tests so that TestBrowserThreadBundle is always created
before RenderViewHostTestEnabler.

Since TestBrowserThreadBundle is created earlier, it also gets
destroyed later. This exposed a flaw in MockRenderProcessHost which
can double-free itself if its posted DeleteSoon is allowed to run,
since RenderViewHostTestEnabler deletes the object directly as well.
So we ensure the posted delete is cancelled if another delete happens
in the meantime.

ExtensionsTest sets up a BrowserClient and must keep it alive until
the MessageLoop/TestBrowserThreadBundle is destroyed in case any tasks
posted would try to use the BrowserClient.

extensions::TestExtensionEnvironment also provides a MessageLoop,
similar to TestBrowserThreadBundle, so must be constructed before
RenderViewHostTestEnabler. We pass it to the constructor for tests
that want to use both together, as we did for the
TestBrowserThreadBundle.

R=fsamuel@chromium.org

Bug: 730213
Change-Id: I6cb0670efd05224fe3a3d98939bcaa32a56cc9ae
Reviewed-on: https://chromium-review.googlesource.com/527675
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#479096}
51 files changed