Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 2197613003: gpu: Introduce GpuChannelEstablishFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/compositor/gpu_process_transport_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 // data during shutdown, so the blocking pool needs to be available. There 1113 // data during shutdown, so the blocking pool needs to be available. There
1114 // may also be slow operations pending that will blcok shutdown, so closing 1114 // may also be slow operations pending that will blcok shutdown, so closing
1115 // it here (which will block until required operations are complete) gives 1115 // it here (which will block until required operations are complete) gives
1116 // more head start for those operations to finish. 1116 // more head start for those operations to finish.
1117 { 1117 {
1118 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); 1118 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool");
1119 BrowserThreadImpl::ShutdownThreadPool(); 1119 BrowserThreadImpl::ShutdownThreadPool();
1120 } 1120 }
1121 // Must happen after the IO thread is shutdown since this may be accessed from 1121 // Must happen after the IO thread is shutdown since this may be accessed from
1122 // it. 1122 // it.
1123 if (!shell::ShellIsRemote()) { 1123 {
1124 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); 1124 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory");
1125 if (BrowserGpuChannelHostFactory::instance()) 1125 if (BrowserGpuChannelHostFactory::instance())
1126 BrowserGpuChannelHostFactory::Terminate(); 1126 BrowserGpuChannelHostFactory::Terminate();
1127 } 1127 }
1128 1128
1129 // Must happen after the I/O thread is shutdown since this class lives on the 1129 // Must happen after the I/O thread is shutdown since this class lives on the
1130 // I/O thread and isn't threadsafe. 1130 // I/O thread and isn't threadsafe.
1131 { 1131 {
1132 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); 1132 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService");
1133 GamepadService::GetInstance()->Terminate(); 1133 GamepadService::GetInstance()->Terminate();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 established_gpu_channel = false; 1204 established_gpu_channel = false;
1205 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); 1205 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup();
1206 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1206 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
1207 #elif defined(USE_AURA) || defined(OS_MACOSX) 1207 #elif defined(USE_AURA) || defined(OS_MACOSX)
1208 established_gpu_channel = true; 1208 established_gpu_channel = true;
1209 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || 1209 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() ||
1210 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || 1210 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) ||
1211 shell::ShellIsRemote()) { 1211 shell::ShellIsRemote()) {
1212 established_gpu_channel = always_uses_gpu = false; 1212 established_gpu_channel = always_uses_gpu = false;
1213 } 1213 }
1214 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1214 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
piman 2016/08/08 15:36:30 Should we avoid doing this if we use the ContentCl
sadrul 2016/08/08 16:25:32 I initially did this, but BrowserGpuChannelHostFac
1215 ImageTransportFactory::Initialize(); 1215 ImageTransportFactory::Initialize();
1216
1217 gpu::GpuChannelEstablishFactory* factory =
1218 GetContentClient()->browser()->GetGpuChannelEstablishFactory();
1219 if (!factory)
1220 factory = BrowserGpuChannelHostFactory::instance();
1221 DCHECK(factory);
1222 ImageTransportFactory::GetInstance()->SetGpuChannelEstablishFactory(factory);
1216 #if defined(USE_AURA) 1223 #if defined(USE_AURA)
1217 bool use_mus_in_renderer = base::CommandLine::ForCurrentProcess()->HasSwitch( 1224 bool use_mus_in_renderer = base::CommandLine::ForCurrentProcess()->HasSwitch(
1218 switches::kUseMusInRenderer); 1225 switches::kUseMusInRenderer);
1219 if (aura::Env::GetInstance() && !use_mus_in_renderer) { 1226 if (aura::Env::GetInstance() && !use_mus_in_renderer) {
1220 aura::Env::GetInstance()->set_context_factory(GetContextFactory()); 1227 aura::Env::GetInstance()->set_context_factory(GetContextFactory());
1221 } 1228 }
1222 #endif // defined(USE_AURA) 1229 #endif // defined(USE_AURA)
1223 #endif // defined(OS_ANDROID) 1230 #endif // defined(OS_ANDROID)
1224 1231
1225 // Enable the GpuMemoryBuffer dump provider with IO thread affinity. Note that 1232 // Enable the GpuMemoryBuffer dump provider with IO thread affinity. Note that
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = 1515 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner =
1509 audio_thread_->task_runner(); 1516 audio_thread_->task_runner();
1510 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), 1517 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner),
1511 std::move(worker_task_runner), 1518 std::move(worker_task_runner),
1512 MediaInternals::GetInstance()); 1519 MediaInternals::GetInstance());
1513 } 1520 }
1514 CHECK(audio_manager_); 1521 CHECK(audio_manager_);
1515 } 1522 }
1516 1523
1517 } // namespace content 1524 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/compositor/gpu_process_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698