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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 // data during shutdown, so the blocking pool needs to be available. There | 1115 // data during shutdown, so the blocking pool needs to be available. There |
1116 // may also be slow operations pending that will blcok shutdown, so closing | 1116 // may also be slow operations pending that will blcok shutdown, so closing |
1117 // it here (which will block until required operations are complete) gives | 1117 // it here (which will block until required operations are complete) gives |
1118 // more head start for those operations to finish. | 1118 // more head start for those operations to finish. |
1119 { | 1119 { |
1120 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); | 1120 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); |
1121 BrowserThreadImpl::ShutdownThreadPool(); | 1121 BrowserThreadImpl::ShutdownThreadPool(); |
1122 } | 1122 } |
1123 // Must happen after the IO thread is shutdown since this may be accessed from | 1123 // Must happen after the IO thread is shutdown since this may be accessed from |
1124 // it. | 1124 // it. |
1125 if (!shell::ShellIsRemote()) { | 1125 { |
1126 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); | 1126 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); |
1127 if (BrowserGpuChannelHostFactory::instance()) | 1127 if (BrowserGpuChannelHostFactory::instance()) |
1128 BrowserGpuChannelHostFactory::Terminate(); | 1128 BrowserGpuChannelHostFactory::Terminate(); |
1129 } | 1129 } |
1130 | 1130 |
1131 // Must happen after the I/O thread is shutdown since this class lives on the | 1131 // Must happen after the I/O thread is shutdown since this class lives on the |
1132 // I/O thread and isn't threadsafe. | 1132 // I/O thread and isn't threadsafe. |
1133 { | 1133 { |
1134 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); | 1134 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); |
1135 GamepadService::GetInstance()->Terminate(); | 1135 GamepadService::GetInstance()->Terminate(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 ContextProviderFactoryImpl::GetInstance()); | 1210 ContextProviderFactoryImpl::GetInstance()); |
1211 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1211 #elif defined(USE_AURA) || defined(OS_MACOSX) |
1212 established_gpu_channel = true; | 1212 established_gpu_channel = true; |
1213 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1213 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
1214 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || | 1214 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || |
1215 shell::ShellIsRemote()) { | 1215 shell::ShellIsRemote()) { |
1216 established_gpu_channel = always_uses_gpu = false; | 1216 established_gpu_channel = always_uses_gpu = false; |
1217 } | 1217 } |
1218 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1218 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
1219 ImageTransportFactory::Initialize(); | 1219 ImageTransportFactory::Initialize(); |
| 1220 |
| 1221 gpu::GpuChannelEstablishFactory* factory = |
| 1222 GetContentClient()->browser()->GetGpuChannelEstablishFactory(); |
| 1223 if (!factory) |
| 1224 factory = BrowserGpuChannelHostFactory::instance(); |
| 1225 DCHECK(factory); |
| 1226 ImageTransportFactory::GetInstance()->SetGpuChannelEstablishFactory(factory); |
1220 #if defined(USE_AURA) | 1227 #if defined(USE_AURA) |
1221 bool use_mus_in_renderer = base::CommandLine::ForCurrentProcess()->HasSwitch( | 1228 bool use_mus_in_renderer = base::CommandLine::ForCurrentProcess()->HasSwitch( |
1222 switches::kUseMusInRenderer); | 1229 switches::kUseMusInRenderer); |
1223 if (aura::Env::GetInstance() && !use_mus_in_renderer) { | 1230 if (aura::Env::GetInstance() && !use_mus_in_renderer) { |
1224 aura::Env::GetInstance()->set_context_factory(GetContextFactory()); | 1231 aura::Env::GetInstance()->set_context_factory(GetContextFactory()); |
1225 } | 1232 } |
1226 #endif // defined(USE_AURA) | 1233 #endif // defined(USE_AURA) |
1227 #endif // defined(OS_ANDROID) | 1234 #endif // defined(OS_ANDROID) |
1228 | 1235 |
1229 // Enable the GpuMemoryBuffer dump provider with IO thread affinity. Note that | 1236 // Enable the GpuMemoryBuffer dump provider with IO thread affinity. Note that |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1520 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
1514 audio_thread_->task_runner(); | 1521 audio_thread_->task_runner(); |
1515 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1522 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
1516 std::move(worker_task_runner), | 1523 std::move(worker_task_runner), |
1517 MediaInternals::GetInstance()); | 1524 MediaInternals::GetInstance()); |
1518 } | 1525 } |
1519 CHECK(audio_manager_); | 1526 CHECK(audio_manager_); |
1520 } | 1527 } |
1521 | 1528 |
1522 } // namespace content | 1529 } // namespace content |
OLD | NEW |