summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_main_loop.cc
diff options
context:
space:
mode:
authorsievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-23 00:50:29 +0000
committersievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-23 00:50:29 +0000
commit96ab016c662e1f982fa37504b454419063d81b85 (patch)
tree82d4166cdfcff978ae54282b0800ed0290a91d41 /content/browser/browser_main_loop.cc
parent29dc9d8c14c1d8cf36242a876017fe827b1c0a34 (diff)
downloadchromium_src-96ab016c662e1f982fa37504b454419063d81b85.zip
chromium_src-96ab016c662e1f982fa37504b454419063d81b85.tar.gz
chromium_src-96ab016c662e1f982fa37504b454419063d81b85.tar.bz2
Allow asynchronous GPU context creation for browser clients
This moves the call to establish a GPU channel out of WGC3D. It adds an asynchronous method to BrowserGpuChannelHostFactory that registers callbacks that are run on the main thread once the channel is established. This is prerequisite work for asynchronous OutputSurface creation. BUG=270179,125248,235300 R=piman@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=228777 Review URL: https://codereview.chromium.org/26959002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_main_loop.cc')
-rw-r--r--content/browser/browser_main_loop.cc32
1 files changed, 21 insertions, 11 deletions
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index f8c8a1c..ee2abf7 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -853,7 +853,8 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
// it.
{
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory");
- BrowserGpuChannelHostFactory::Terminate();
+ if (BrowserGpuChannelHostFactory::instance())
+ BrowserGpuChannelHostFactory::Terminate();
}
// Must happen after the I/O thread is shutdown since this class lives on the
@@ -910,9 +911,26 @@ int BrowserMainLoop::BrowserThreadsStarted() {
#if !defined(OS_IOS)
HistogramSynchronizer::GetInstance();
- BrowserGpuChannelHostFactory::Initialize();
+ // Initialize the GpuDataManager before we set up the MessageLoops because
+ // otherwise we'll trigger the assertion about doing IO on the UI thread.
+ GpuDataManagerImpl::GetInstance()->Initialize();
+
+ bool always_uses_gpu = IsForceCompositingModeEnabled();
+ bool established_gpu_channel = false;
+#if defined(USE_AURA) || defined(OS_ANDROID)
+ established_gpu_channel =
+ !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) ||
+ parsed_command_line_.HasSwitch(switches::kSingleProcess) ||
+ parsed_command_line_.HasSwitch(switches::kInProcessGPU);
#if defined(USE_AURA)
+ if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) {
+ established_gpu_channel = always_uses_gpu = false;
+ }
+ BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
ImageTransportFactory::Initialize();
+#elif defined(OS_ANDROID)
+ BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
+#endif
#endif
#if defined(OS_LINUX)
@@ -935,10 +953,6 @@ int BrowserMainLoop::BrowserThreadsStarted() {
media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
}
- // Initialize the GpuDataManager before we set up the MessageLoops because
- // otherwise we'll trigger the assertion about doing IO on the UI thread.
- GpuDataManagerImpl::GetInstance()->Initialize();
-
{
TRACE_EVENT0("startup",
"BrowserMainLoop::BrowserThreadsStarted:InitSpeechRecognition");
@@ -969,12 +983,8 @@ int BrowserMainLoop::BrowserThreadsStarted() {
// When running the GPU thread in-process, avoid optimistically starting it
// since creating the GPU thread races against creation of the one-and-only
// ChildProcess instance which is created by the renderer thread.
- bool always_uses_gpu = IsForceCompositingModeEnabled();
-#if defined(USE_AURA)
- if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor())
- always_uses_gpu = false;
-#endif
if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) &&
+ !established_gpu_channel &&
always_uses_gpu &&
!parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) &&
!parsed_command_line_.HasSwitch(switches::kSingleProcess) &&