| 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 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 { | 1349 { |
| 1351 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:TaskScheduler"); | 1350 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:TaskScheduler"); |
| 1352 base::TaskScheduler::GetInstance()->Shutdown(); | 1351 base::TaskScheduler::GetInstance()->Shutdown(); |
| 1353 } | 1352 } |
| 1354 | 1353 |
| 1355 // Must happen after the IO thread is shutdown since this may be accessed from | 1354 // Must happen after the IO thread is shutdown since this may be accessed from |
| 1356 // it. | 1355 // it. |
| 1357 { | 1356 { |
| 1358 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); | 1357 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); |
| 1359 if (BrowserGpuChannelHostFactory::instance()) { | 1358 if (BrowserGpuChannelHostFactory::instance()) { |
| 1360 #if defined(OS_ANDROID) | |
| 1361 // Clean up the references to the factory before terminating it. | |
| 1362 ui::ContextProviderFactory::SetInstance(nullptr); | |
| 1363 ContextProviderFactoryImpl::Terminate(); | |
| 1364 #endif | |
| 1365 BrowserGpuChannelHostFactory::Terminate(); | 1359 BrowserGpuChannelHostFactory::Terminate(); |
| 1366 } | 1360 } |
| 1367 } | 1361 } |
| 1368 | 1362 |
| 1369 // Must happen after the I/O thread is shutdown since this class lives on the | 1363 // Must happen after the I/O thread is shutdown since this class lives on the |
| 1370 // I/O thread and isn't threadsafe. | 1364 // I/O thread and isn't threadsafe. |
| 1371 { | 1365 { |
| 1372 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); | 1366 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); |
| 1373 device::GamepadService::GetInstance()->Terminate(); | 1367 device::GamepadService::GetInstance()->Terminate(); |
| 1374 } | 1368 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), | 1438 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 1445 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); | 1439 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); |
| 1446 | 1440 |
| 1447 bool always_uses_gpu = true; | 1441 bool always_uses_gpu = true; |
| 1448 bool established_gpu_channel = false; | 1442 bool established_gpu_channel = false; |
| 1449 #if defined(OS_ANDROID) | 1443 #if defined(OS_ANDROID) |
| 1450 // TODO(crbug.com/439322): This should be set to |true|. | 1444 // TODO(crbug.com/439322): This should be set to |true|. |
| 1451 established_gpu_channel = false; | 1445 established_gpu_channel = false; |
| 1452 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); | 1446 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); |
| 1453 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1447 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| 1454 ContextProviderFactoryImpl::Initialize( | |
| 1455 BrowserGpuChannelHostFactory::instance()); | |
| 1456 ui::ContextProviderFactory::SetInstance( | |
| 1457 ContextProviderFactoryImpl::GetInstance()); | |
| 1458 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1448 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 1459 established_gpu_channel = true; | 1449 established_gpu_channel = true; |
| 1460 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1450 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
| 1461 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || | 1451 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || |
| 1462 service_manager::ServiceManagerIsRemote()) { | 1452 service_manager::ServiceManagerIsRemote()) { |
| 1463 established_gpu_channel = always_uses_gpu = false; | 1453 established_gpu_channel = always_uses_gpu = false; |
| 1464 } | 1454 } |
| 1465 gpu::GpuChannelEstablishFactory* factory = | 1455 gpu::GpuChannelEstablishFactory* factory = |
| 1466 GetContentClient()->browser()->GetGpuChannelEstablishFactory(); | 1456 GetContentClient()->browser()->GetGpuChannelEstablishFactory(); |
| 1467 if (!factory) { | 1457 if (!factory) { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1778 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
| 1789 MediaInternals::GetInstance()); | 1779 MediaInternals::GetInstance()); |
| 1790 } | 1780 } |
| 1791 CHECK(audio_manager_); | 1781 CHECK(audio_manager_); |
| 1792 | 1782 |
| 1793 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1783 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
| 1794 CHECK(audio_system_); | 1784 CHECK(audio_system_); |
| 1795 } | 1785 } |
| 1796 | 1786 |
| 1797 } // namespace content | 1787 } // namespace content |
| OLD | NEW |