Commit ffde0e3c authored by Eric Karl's avatar Eric Karl Committed by Commit Bot

Android OOP-D: Ensure HostFrameSinkManager is always available

Currently, we initialize HostFrameSinkManager at CompositorImpl
creation, rather than at first request, which leads to the manager not
being available at first use in rare cases where a
DelegatedFrameHostAndroid is created before a CompositorImpl.

This change shuffles logic around so that a HostFrameSinkManager is
always available and doesn't rely on CompositorImpl timing.

Bug: 858857
Change-Id: Ia708eaf35d9d39cd65c51b73e4ec6202b59fbb43
Reviewed-on: https://chromium-review.googlesource.com/1120937Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Commit-Queue: Eric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571656}
parent 5f93deb6
...@@ -149,13 +149,13 @@ class CompositorDependencies { ...@@ -149,13 +149,13 @@ class CompositorDependencies {
mojo::MakeRequest(&frame_sink_manager_client); mojo::MakeRequest(&frame_sink_manager_client);
// Setup HostFrameSinkManager with interface endpoints. // Setup HostFrameSinkManager with interface endpoints.
GetHostFrameSinkManager()->BindAndSetManager( host_frame_sink_manager.BindAndSetManager(
std::move(frame_sink_manager_client_request), std::move(frame_sink_manager_client_request),
base::ThreadTaskRunnerHandle::Get(), std::move(frame_sink_manager)); base::ThreadTaskRunnerHandle::Get(), std::move(frame_sink_manager));
// Set up a callback to automatically re-connect if we lose our // Set up a callback to automatically re-connect if we lose our
// connection. // connection.
GetHostFrameSinkManager()->SetConnectionLostCallback(base::BindRepeating( host_frame_sink_manager.SetConnectionLostCallback(base::BindRepeating(
[]() { CompositorDependencies::Get().CreateVizFrameSinkManager(); })); []() { CompositorDependencies::Get().CreateVizFrameSinkManager(); }));
BrowserMainLoop::GetInstance() BrowserMainLoop::GetInstance()
...@@ -196,6 +196,8 @@ class CompositorDependencies { ...@@ -196,6 +196,8 @@ class CompositorDependencies {
/*shared_bitmap_manager=*/nullptr); /*shared_bitmap_manager=*/nullptr);
surface_utils::ConnectWithLocalFrameSinkManager( surface_utils::ConnectWithLocalFrameSinkManager(
&host_frame_sink_manager, frame_sink_manager_impl.get()); &host_frame_sink_manager, frame_sink_manager_impl.get());
} else {
CreateVizFrameSinkManager();
} }
} }
...@@ -625,12 +627,6 @@ CompositorImpl::CompositorImpl(CompositorClient* client, ...@@ -625,12 +627,6 @@ CompositorImpl::CompositorImpl(CompositorClient* client,
enable_viz_( enable_viz_(
base::FeatureList::IsEnabled(features::kVizDisplayCompositor)), base::FeatureList::IsEnabled(features::kVizDisplayCompositor)),
weak_factory_(this) { weak_factory_(this) {
// In Viz mode, we create the frame sink manager here. For some reason we
// can't do this in the CompositorDependencies constructor.
// TODO(ericrk): Investigate this.
if (enable_viz_)
CompositorDependencies::Get().CreateVizFrameSinkManager();
GetHostFrameSinkManager()->RegisterFrameSinkId(frame_sink_id_, this); GetHostFrameSinkManager()->RegisterFrameSinkId(frame_sink_id_, this);
GetHostFrameSinkManager()->SetFrameSinkDebugLabel(frame_sink_id_, GetHostFrameSinkManager()->SetFrameSinkDebugLabel(frame_sink_id_,
"CompositorImpl"); "CompositorImpl");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment