Commit 1902f898 authored by Jonathan's avatar Jonathan Committed by Commit Bot

Update MusContextFactory ContextProvider Binding

Update MusContextFactory to force the new ContextProvider to BindToCurrentThread
immediately. This way we can detect errors in the mojo pipe and exit cleanly.

Rather than attempting to bind later on in the initialization process of the
LayerTreeFrameSink.

TEST=mash_browser_tests

Bug: 743028
Change-Id: I3806f779360d70df5b8e974e9f49c0c5f634b465
Reviewed-on: https://chromium-review.googlesource.com/577771
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488248}
parent 452d6f27
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "cc/base/switches.h" #include "cc/base/switches.h"
#include "components/viz/common/gpu/context_provider.h"
#include "services/ui/public/cpp/gpu/gpu.h" #include "services/ui/public/cpp/gpu/gpu.h"
#include "ui/aura/mus/window_port_mus.h" #include "ui/aura/mus/window_port_mus.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"
...@@ -53,10 +54,16 @@ void MusContextFactory::OnEstablishedGpuChannel( ...@@ -53,10 +54,16 @@ void MusContextFactory::OnEstablishedGpuChannel(
WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); WindowTreeHost::GetForAcceleratedWidget(compositor->widget());
WindowPortMus* window_port = WindowPortMus::Get(host->window()); WindowPortMus* window_port = WindowPortMus::Get(host->window());
DCHECK(window_port); DCHECK(window_port);
scoped_refptr<viz::ContextProvider> context_provider =
gpu_->CreateContextProvider(std::move(gpu_channel));
// If the binding fails, then we need to return early since the compositor
// expects a successfully initialized/bound provider.
if (!context_provider->BindToCurrentThread())
return;
std::unique_ptr<cc::LayerTreeFrameSink> layer_tree_frame_sink = std::unique_ptr<cc::LayerTreeFrameSink> layer_tree_frame_sink =
window_port->RequestLayerTreeFrameSink( window_port->RequestLayerTreeFrameSink(std::move(context_provider),
gpu_->CreateContextProvider(std::move(gpu_channel)), gpu_->gpu_memory_buffer_manager());
gpu_->gpu_memory_buffer_manager());
compositor->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); compositor->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink));
} }
......
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