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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 #include "ui/aura/env.h" | 118 #include "ui/aura/env.h" |
119 #endif | 119 #endif |
120 | 120 |
121 #if defined(OS_ANDROID) | 121 #if defined(OS_ANDROID) |
122 #include "base/android/jni_android.h" | 122 #include "base/android/jni_android.h" |
123 #include "components/tracing/common/graphics_memory_dump_provider_android.h" | 123 #include "components/tracing/common/graphics_memory_dump_provider_android.h" |
124 #include "content/browser/android/browser_startup_controller.h" | 124 #include "content/browser/android/browser_startup_controller.h" |
125 #include "content/browser/android/scoped_surface_request_manager.h" | 125 #include "content/browser/android/scoped_surface_request_manager.h" |
126 #include "content/browser/android/tracing_controller_android.h" | 126 #include "content/browser/android/tracing_controller_android.h" |
127 #include "content/browser/media/android/browser_media_player_manager.h" | 127 #include "content/browser/media/android/browser_media_player_manager.h" |
128 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" | |
129 #include "content/browser/screen_orientation/screen_orientation_delegate_android
.h" | 128 #include "content/browser/screen_orientation/screen_orientation_delegate_android
.h" |
130 #include "media/base/android/media_client_android.h" | 129 #include "media/base/android/media_client_android.h" |
131 #include "ui/android/screen_android.h" | 130 #include "ui/android/screen_android.h" |
132 #include "ui/display/screen.h" | 131 #include "ui/display/screen.h" |
133 #include "ui/gl/gl_surface.h" | 132 #include "ui/gl/gl_surface.h" |
134 #endif | 133 #endif |
135 | 134 |
136 #if defined(OS_MACOSX) | 135 #if defined(OS_MACOSX) |
137 #include "base/memory/memory_pressure_monitor_mac.h" | 136 #include "base/memory/memory_pressure_monitor_mac.h" |
138 #include "content/browser/bootstrap_sandbox_manager_mac.h" | 137 #include "content/browser/bootstrap_sandbox_manager_mac.h" |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 { | 1348 { |
1350 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:TaskScheduler"); | 1349 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:TaskScheduler"); |
1351 base::TaskScheduler::GetInstance()->Shutdown(); | 1350 base::TaskScheduler::GetInstance()->Shutdown(); |
1352 } | 1351 } |
1353 | 1352 |
1354 // Must happen after the IO thread is shutdown since this may be accessed from | 1353 // Must happen after the IO thread is shutdown since this may be accessed from |
1355 // it. | 1354 // it. |
1356 { | 1355 { |
1357 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); | 1356 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); |
1358 if (BrowserGpuChannelHostFactory::instance()) { | 1357 if (BrowserGpuChannelHostFactory::instance()) { |
1359 #if defined(OS_ANDROID) | |
1360 // Clean up the references to the factory before terminating it. | |
1361 ui::ContextProviderFactory::SetInstance(nullptr); | |
1362 ContextProviderFactoryImpl::Terminate(); | |
1363 #endif | |
1364 BrowserGpuChannelHostFactory::Terminate(); | 1358 BrowserGpuChannelHostFactory::Terminate(); |
1365 } | 1359 } |
1366 } | 1360 } |
1367 | 1361 |
1368 // Must happen after the I/O thread is shutdown since this class lives on the | 1362 // Must happen after the I/O thread is shutdown since this class lives on the |
1369 // I/O thread and isn't threadsafe. | 1363 // I/O thread and isn't threadsafe. |
1370 { | 1364 { |
1371 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); | 1365 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); |
1372 device::GamepadService::GetInstance()->Terminate(); | 1366 device::GamepadService::GetInstance()->Terminate(); |
1373 } | 1367 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), | 1437 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
1444 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); | 1438 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); |
1445 | 1439 |
1446 bool always_uses_gpu = true; | 1440 bool always_uses_gpu = true; |
1447 bool established_gpu_channel = false; | 1441 bool established_gpu_channel = false; |
1448 #if defined(OS_ANDROID) | 1442 #if defined(OS_ANDROID) |
1449 // TODO(crbug.com/439322): This should be set to |true|. | 1443 // TODO(crbug.com/439322): This should be set to |true|. |
1450 established_gpu_channel = false; | 1444 established_gpu_channel = false; |
1451 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); | 1445 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); |
1452 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1446 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
1453 ContextProviderFactoryImpl::Initialize( | |
1454 BrowserGpuChannelHostFactory::instance()); | |
1455 ui::ContextProviderFactory::SetInstance( | |
1456 ContextProviderFactoryImpl::GetInstance()); | |
1457 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1447 #elif defined(USE_AURA) || defined(OS_MACOSX) |
1458 established_gpu_channel = true; | 1448 established_gpu_channel = true; |
1459 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1449 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
1460 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || | 1450 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || |
1461 service_manager::ServiceManagerIsRemote()) { | 1451 service_manager::ServiceManagerIsRemote()) { |
1462 established_gpu_channel = always_uses_gpu = false; | 1452 established_gpu_channel = always_uses_gpu = false; |
1463 } | 1453 } |
1464 gpu::GpuChannelEstablishFactory* factory = | 1454 gpu::GpuChannelEstablishFactory* factory = |
1465 GetContentClient()->browser()->GetGpuChannelEstablishFactory(); | 1455 GetContentClient()->browser()->GetGpuChannelEstablishFactory(); |
1466 if (!factory) { | 1456 if (!factory) { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1787 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
1798 MediaInternals::GetInstance()); | 1788 MediaInternals::GetInstance()); |
1799 } | 1789 } |
1800 CHECK(audio_manager_); | 1790 CHECK(audio_manager_); |
1801 | 1791 |
1802 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1792 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
1803 CHECK(audio_system_); | 1793 CHECK(audio_system_); |
1804 } | 1794 } |
1805 | 1795 |
1806 } // namespace content | 1796 } // namespace content |
OLD | NEW |