Commit 0bc48dda authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

mus: Do not create GpuProcessTransportFactory.

GpuProcessTransportFactory should not be created when running with mus.

BUG=none

Change-Id: I888455b68b9fad81d9e7bbb9b16b683df2abd5a5
Reviewed-on: https://chromium-review.googlesource.com/661337Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501438}
parent 56279196
...@@ -1446,8 +1446,9 @@ int BrowserMainLoop::BrowserThreadsStarted() { ...@@ -1446,8 +1446,9 @@ int BrowserMainLoop::BrowserThreadsStarted() {
memory_instrumentation::mojom::ProcessType::BROWSER); memory_instrumentation::mojom::ProcessType::BROWSER);
memory_instrumentation::ClientProcessImpl::CreateInstance(config); memory_instrumentation::ClientProcessImpl::CreateInstance(config);
const bool is_mus = IsUsingMus();
#if defined(USE_AURA) #if defined(USE_AURA)
if (IsUsingMus()) { if (is_mus) {
base::CommandLine::ForCurrentProcess()->AppendSwitch( base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kIsRunningInMash); switches::kIsRunningInMash);
base::CommandLine::ForCurrentProcess()->AppendSwitch( base::CommandLine::ForCurrentProcess()->AppendSwitch(
...@@ -1485,7 +1486,7 @@ int BrowserMainLoop::BrowserThreadsStarted() { ...@@ -1485,7 +1486,7 @@ int BrowserMainLoop::BrowserThreadsStarted() {
established_gpu_channel = true; established_gpu_channel = true;
if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() ||
parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) ||
IsUsingMus()) { is_mus) {
established_gpu_channel = always_uses_gpu = false; established_gpu_channel = always_uses_gpu = false;
} }
gpu::GpuChannelEstablishFactory* factory = gpu::GpuChannelEstablishFactory* factory =
...@@ -1495,7 +1496,7 @@ int BrowserMainLoop::BrowserThreadsStarted() { ...@@ -1495,7 +1496,7 @@ int BrowserMainLoop::BrowserThreadsStarted() {
factory = BrowserGpuChannelHostFactory::instance(); factory = BrowserGpuChannelHostFactory::instance();
} }
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
if (!IsUsingMus()) { if (!is_mus) {
// TODO(kylechar): Remove flag along with surface sequences. // TODO(kylechar): Remove flag along with surface sequences.
// See https://crbug.com/676384. // See https://crbug.com/676384.
auto surface_lifetime_type = auto surface_lifetime_type =
...@@ -1516,8 +1517,11 @@ int BrowserMainLoop::BrowserThreadsStarted() { ...@@ -1516,8 +1517,11 @@ int BrowserMainLoop::BrowserThreadsStarted() {
#endif #endif
DCHECK(factory); DCHECK(factory);
ImageTransportFactory::Initialize(GetResizeTaskRunner()); if (!is_mus) {
ImageTransportFactory::GetInstance()->SetGpuChannelEstablishFactory(factory); ImageTransportFactory::Initialize(GetResizeTaskRunner());
ImageTransportFactory::GetInstance()->SetGpuChannelEstablishFactory(
factory);
}
#if defined(USE_AURA) #if defined(USE_AURA)
if (env_->mode() == aura::Env::Mode::LOCAL) { if (env_->mode() == aura::Env::Mode::LOCAL) {
env_->set_context_factory(GetContextFactory()); env_->set_context_factory(GetContextFactory());
...@@ -1619,7 +1623,7 @@ int BrowserMainLoop::BrowserThreadsStarted() { ...@@ -1619,7 +1623,7 @@ int BrowserMainLoop::BrowserThreadsStarted() {
// ChildProcess instance which is created by the renderer thread. // ChildProcess instance which is created by the renderer thread.
if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) && if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) &&
!established_gpu_channel && always_uses_gpu && !UsingInProcessGpu() && !established_gpu_channel && always_uses_gpu && !UsingInProcessGpu() &&
!IsUsingMus()) { !is_mus) {
TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process", TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process",
TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_SCOPE_THREAD);
BrowserThread::PostTask( BrowserThread::PostTask(
......
...@@ -80,9 +80,6 @@ bool AuraWindowCaptureMachine::InternalStart( ...@@ -80,9 +80,6 @@ bool AuraWindowCaptureMachine::InternalStart(
// Update capture size. // Update capture size.
UpdateCaptureSize(); UpdateCaptureSize();
// Start observing for GL context losses.
ImageTransportFactory::GetInstance()->GetContextFactory()->AddObserver(this);
// Start observing compositor updates. // Start observing compositor updates.
aura::WindowTreeHost* const host = desktop_window_->GetHost(); aura::WindowTreeHost* const host = desktop_window_->GetHost();
ui::Compositor* const compositor = host ? host->compositor() : nullptr; ui::Compositor* const compositor = host ? host->compositor() : nullptr;
...@@ -90,6 +87,9 @@ bool AuraWindowCaptureMachine::InternalStart( ...@@ -90,6 +87,9 @@ bool AuraWindowCaptureMachine::InternalStart(
return false; return false;
compositor->AddAnimationObserver(this); compositor->AddAnimationObserver(this);
// Start observing for GL context losses.
compositor->context_factory()->AddObserver(this);
DCHECK(!wake_lock_); DCHECK(!wake_lock_);
// Request Wake Lock. In some testing contexts, the service manager // Request Wake Lock. In some testing contexts, the service manager
// connection isn't initialized. // connection isn't initialized.
...@@ -159,17 +159,16 @@ void AuraWindowCaptureMachine::InternalStop(const base::Closure& callback) { ...@@ -159,17 +159,16 @@ void AuraWindowCaptureMachine::InternalStop(const base::Closure& callback) {
// Stop observing compositor and window events. // Stop observing compositor and window events.
if (desktop_window_) { if (desktop_window_) {
if (aura::WindowTreeHost* host = desktop_window_->GetHost()) { if (aura::WindowTreeHost* host = desktop_window_->GetHost()) {
if (ui::Compositor* compositor = host->compositor()) if (ui::Compositor* compositor = host->compositor()) {
compositor->RemoveAnimationObserver(this); compositor->RemoveAnimationObserver(this);
compositor->context_factory()->RemoveObserver(this);
}
} }
desktop_window_->RemoveObserver(this); desktop_window_->RemoveObserver(this);
desktop_window_ = NULL; desktop_window_ = NULL;
cursor_renderer_.reset(); cursor_renderer_.reset();
} }
// Stop observing for GL context losses.
ImageTransportFactory::GetInstance()->GetContextFactory()->RemoveObserver(
this);
OnLostResources(); OnLostResources();
callback.Run(); callback.Run();
...@@ -436,8 +435,10 @@ void AuraWindowCaptureMachine::OnWindowRemovingFromRootWindow( ...@@ -436,8 +435,10 @@ void AuraWindowCaptureMachine::OnWindowRemovingFromRootWindow(
DCHECK(window == desktop_window_); DCHECK(window == desktop_window_);
if (aura::WindowTreeHost* host = window->GetHost()) { if (aura::WindowTreeHost* host = window->GetHost()) {
if (ui::Compositor* compositor = host->compositor()) if (ui::Compositor* compositor = host->compositor()) {
compositor->RemoveAnimationObserver(this); compositor->RemoveAnimationObserver(this);
compositor->context_factory()->RemoveObserver(this);
}
} }
} }
...@@ -466,6 +467,7 @@ void AuraWindowCaptureMachine::OnCompositingShuttingDown( ...@@ -466,6 +467,7 @@ void AuraWindowCaptureMachine::OnCompositingShuttingDown(
ui::Compositor* compositor) { ui::Compositor* compositor) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
compositor->RemoveAnimationObserver(this); compositor->RemoveAnimationObserver(this);
compositor->context_factory()->RemoveObserver(this);
} }
void AuraWindowCaptureMachine::OnLostResources() { void AuraWindowCaptureMachine::OnLostResources() {
......
...@@ -403,7 +403,8 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, ...@@ -403,7 +403,8 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,
is_guest_view_hack_(is_guest_view_hack), is_guest_view_hack_(is_guest_view_hack),
device_scale_factor_(0.0f), device_scale_factor_(0.0f),
event_handler_(new RenderWidgetHostViewEventHandler(host_, this, this)), event_handler_(new RenderWidgetHostViewEventHandler(host_, this, this)),
frame_sink_id_(host_->AllocateFrameSinkId(is_guest_view_hack_)), frame_sink_id_(IsMus() ? viz::FrameSinkId()
: host_->AllocateFrameSinkId(is_guest_view_hack_)),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
if (!is_guest_view_hack_) if (!is_guest_view_hack_)
host_->SetView(this); host_->SetView(this);
......
...@@ -153,7 +153,7 @@ void RenderWidgetHostViewChildFrame::SetFrameConnectorDelegate( ...@@ -153,7 +153,7 @@ void RenderWidgetHostViewChildFrame::SetFrameConnectorDelegate(
RenderWidgetHostViewBase* parent_view = RenderWidgetHostViewBase* parent_view =
frame_connector_->GetParentRenderWidgetHostView(); frame_connector_->GetParentRenderWidgetHostView();
if (parent_view) { if (parent_view) {
DCHECK(parent_view->GetFrameSinkId().is_valid()); DCHECK(parent_view->GetFrameSinkId().is_valid() || IsUsingMus());
SetParentFrameSinkId(parent_view->GetFrameSinkId()); SetParentFrameSinkId(parent_view->GetFrameSinkId());
} }
......
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