| OLD | NEW |
| 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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 | 1204 |
| 1205 int BrowserMainLoop::BrowserThreadsStarted() { | 1205 int BrowserMainLoop::BrowserThreadsStarted() { |
| 1206 TRACE_EVENT0("startup", "BrowserMainLoop::BrowserThreadsStarted"); | 1206 TRACE_EVENT0("startup", "BrowserMainLoop::BrowserThreadsStarted"); |
| 1207 | 1207 |
| 1208 // Bring up Mojo IPC and shell as early as possible. Initializaing mojo | 1208 // Bring up Mojo IPC and shell as early as possible. Initializaing mojo |
| 1209 // requires the IO thread to have been initialized first. So this cannot | 1209 // requires the IO thread to have been initialized first. So this cannot |
| 1210 // happen any earlier than this. | 1210 // happen any earlier than this. |
| 1211 InitializeMojo(); | 1211 InitializeMojo(); |
| 1212 | 1212 |
| 1213 #if defined(USE_AURA) | 1213 #if defined(USE_AURA) |
| 1214 if (shell::ShellIsRemote()) { | 1214 if (service_manager::ServiceManagerIsRemote()) { |
| 1215 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1215 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1216 switches::kIsRunningInMash); | 1216 switches::kIsRunningInMash); |
| 1217 } | 1217 } |
| 1218 #endif | 1218 #endif |
| 1219 | 1219 |
| 1220 indexed_db_thread_.reset(new base::Thread("IndexedDB")); | 1220 indexed_db_thread_.reset(new base::Thread("IndexedDB")); |
| 1221 indexed_db_thread_->Start(); | 1221 indexed_db_thread_->Start(); |
| 1222 | 1222 |
| 1223 HistogramSynchronizer::GetInstance(); | 1223 HistogramSynchronizer::GetInstance(); |
| 1224 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 1224 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1241 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); | 1241 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); |
| 1242 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1242 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| 1243 ContextProviderFactoryImpl::Initialize( | 1243 ContextProviderFactoryImpl::Initialize( |
| 1244 BrowserGpuChannelHostFactory::instance()); | 1244 BrowserGpuChannelHostFactory::instance()); |
| 1245 ui::ContextProviderFactory::SetInstance( | 1245 ui::ContextProviderFactory::SetInstance( |
| 1246 ContextProviderFactoryImpl::GetInstance()); | 1246 ContextProviderFactoryImpl::GetInstance()); |
| 1247 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1247 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 1248 established_gpu_channel = true; | 1248 established_gpu_channel = true; |
| 1249 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1249 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
| 1250 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || | 1250 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || |
| 1251 shell::ShellIsRemote()) { | 1251 service_manager::ServiceManagerIsRemote()) { |
| 1252 established_gpu_channel = always_uses_gpu = false; | 1252 established_gpu_channel = always_uses_gpu = false; |
| 1253 } | 1253 } |
| 1254 gpu::GpuChannelEstablishFactory* factory = | 1254 gpu::GpuChannelEstablishFactory* factory = |
| 1255 GetContentClient()->browser()->GetGpuChannelEstablishFactory(); | 1255 GetContentClient()->browser()->GetGpuChannelEstablishFactory(); |
| 1256 if (!factory) { | 1256 if (!factory) { |
| 1257 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1257 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| 1258 factory = BrowserGpuChannelHostFactory::instance(); | 1258 factory = BrowserGpuChannelHostFactory::instance(); |
| 1259 } | 1259 } |
| 1260 DCHECK(factory); | 1260 DCHECK(factory); |
| 1261 ImageTransportFactory::Initialize(); | 1261 ImageTransportFactory::Initialize(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 allowed_clipboard_threads.push_back(file_thread_->GetThreadId()); | 1362 allowed_clipboard_threads.push_back(file_thread_->GetThreadId()); |
| 1363 allowed_clipboard_threads.push_back(io_thread_->GetThreadId()); | 1363 allowed_clipboard_threads.push_back(io_thread_->GetThreadId()); |
| 1364 #endif | 1364 #endif |
| 1365 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads); | 1365 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads); |
| 1366 | 1366 |
| 1367 // When running the GPU thread in-process, avoid optimistically starting it | 1367 // When running the GPU thread in-process, avoid optimistically starting it |
| 1368 // since creating the GPU thread races against creation of the one-and-only | 1368 // since creating the GPU thread races against creation of the one-and-only |
| 1369 // ChildProcess instance which is created by the renderer thread. | 1369 // ChildProcess instance which is created by the renderer thread. |
| 1370 if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) && | 1370 if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) && |
| 1371 !established_gpu_channel && always_uses_gpu && !UsingInProcessGpu() && | 1371 !established_gpu_channel && always_uses_gpu && !UsingInProcessGpu() && |
| 1372 !shell::ShellIsRemote()) { | 1372 !service_manager::ServiceManagerIsRemote()) { |
| 1373 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process", | 1373 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process", |
| 1374 TRACE_EVENT_SCOPE_THREAD); | 1374 TRACE_EVENT_SCOPE_THREAD); |
| 1375 BrowserThread::PostTask( | 1375 BrowserThread::PostTask( |
| 1376 BrowserThread::IO, FROM_HERE, | 1376 BrowserThread::IO, FROM_HERE, |
| 1377 base::Bind(base::IgnoreResult(&GpuProcessHost::Get), | 1377 base::Bind(base::IgnoreResult(&GpuProcessHost::Get), |
| 1378 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 1378 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 1379 true /* force_create */)); | 1379 true /* force_create */)); |
| 1380 } | 1380 } |
| 1381 | 1381 |
| 1382 #if defined(OS_MACOSX) | 1382 #if defined(OS_MACOSX) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1566 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
| 1567 audio_thread_->task_runner(); | 1567 audio_thread_->task_runner(); |
| 1568 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1568 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
| 1569 std::move(worker_task_runner), | 1569 std::move(worker_task_runner), |
| 1570 MediaInternals::GetInstance()); | 1570 MediaInternals::GetInstance()); |
| 1571 } | 1571 } |
| 1572 CHECK(audio_manager_); | 1572 CHECK(audio_manager_); |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 } // namespace content | 1575 } // namespace content |
| OLD | NEW |