Chromium Code Reviews| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 #include "content/browser/audio_manager_thread.h" | 54 #include "content/browser/audio_manager_thread.h" |
| 55 #include "content/browser/browser_thread_impl.h" | 55 #include "content/browser/browser_thread_impl.h" |
| 56 #include "content/browser/dom_storage/dom_storage_area.h" | 56 #include "content/browser/dom_storage/dom_storage_area.h" |
| 57 #include "content/browser/download/download_resource_handler.h" | 57 #include "content/browser/download/download_resource_handler.h" |
| 58 #include "content/browser/download/save_file_manager.h" | 58 #include "content/browser/download/save_file_manager.h" |
| 59 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 59 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 60 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 60 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 61 #include "content/browser/gpu/compositor_util.h" | 61 #include "content/browser/gpu/compositor_util.h" |
| 62 #include "content/browser/gpu/gpu_data_manager_impl.h" | 62 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 63 #include "content/browser/gpu/gpu_process_host.h" | 63 #include "content/browser/gpu/gpu_process_host.h" |
| 64 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | |
| 65 #include "content/browser/gpu/shader_cache_factory.h" | 64 #include "content/browser/gpu/shader_cache_factory.h" |
| 66 #include "content/browser/histogram_synchronizer.h" | 65 #include "content/browser/histogram_synchronizer.h" |
| 67 #include "content/browser/leveldb_wrapper_impl.h" | 66 #include "content/browser/leveldb_wrapper_impl.h" |
| 68 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 67 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 69 #include "content/browser/loader_delegate_impl.h" | 68 #include "content/browser/loader_delegate_impl.h" |
| 70 #include "content/browser/media/media_internals.h" | 69 #include "content/browser/media/media_internals.h" |
| 71 #include "content/browser/memory/memory_coordinator_impl.h" | 70 #include "content/browser/memory/memory_coordinator_impl.h" |
| 72 #include "content/browser/net/browser_online_state_observer.h" | 71 #include "content/browser/net/browser_online_state_observer.h" |
| 73 #include "content/browser/renderer_host/media/media_stream_manager.h" | 72 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 74 #include "content/browser/renderer_host/render_process_host_impl.h" | 73 #include "content/browser/renderer_host/render_process_host_impl.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 | 111 |
| 113 #if defined(USE_AURA) || defined(OS_MACOSX) | 112 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 114 #include "content/browser/compositor/image_transport_factory.h" | 113 #include "content/browser/compositor/image_transport_factory.h" |
| 115 #endif | 114 #endif |
| 116 | 115 |
| 117 #if defined(USE_AURA) | 116 #if defined(USE_AURA) |
| 118 #include "content/public/browser/context_factory.h" | 117 #include "content/public/browser/context_factory.h" |
| 119 #include "ui/aura/env.h" | 118 #include "ui/aura/env.h" |
| 120 #endif | 119 #endif |
| 121 | 120 |
| 121 #if defined(USE_OZONE) | |
| 122 #include "ui/ozone/public/gpu_platform_support_host.h" | |
| 123 #include "ui/ozone/public/ozone_platform.h" | |
| 124 #endif | |
| 125 | |
| 122 #if defined(OS_ANDROID) | 126 #if defined(OS_ANDROID) |
| 123 #include "base/android/jni_android.h" | 127 #include "base/android/jni_android.h" |
| 124 #include "components/tracing/common/graphics_memory_dump_provider_android.h" | 128 #include "components/tracing/common/graphics_memory_dump_provider_android.h" |
| 125 #include "content/browser/android/browser_startup_controller.h" | 129 #include "content/browser/android/browser_startup_controller.h" |
| 126 #include "content/browser/android/launcher_thread.h" | 130 #include "content/browser/android/launcher_thread.h" |
| 127 #include "content/browser/android/scoped_surface_request_manager.h" | 131 #include "content/browser/android/scoped_surface_request_manager.h" |
| 128 #include "content/browser/android/tracing_controller_android.h" | 132 #include "content/browser/android/tracing_controller_android.h" |
| 129 #include "content/browser/media/android/browser_media_player_manager.h" | 133 #include "content/browser/media/android/browser_media_player_manager.h" |
| 130 #include "content/browser/screen_orientation/screen_orientation_delegate_android .h" | 134 #include "content/browser/screen_orientation/screen_orientation_delegate_android .h" |
| 131 #include "media/base/android/media_drm_bridge_client.h" | 135 #include "media/base/android/media_drm_bridge_client.h" |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 639 // DO NOT add more code here. Use PreMainMessageLoopStart() above or | 643 // DO NOT add more code here. Use PreMainMessageLoopStart() above or |
| 640 // PostMainMessageLoopStart() below. | 644 // PostMainMessageLoopStart() below. |
| 641 | 645 |
| 642 TRACE_EVENT0("startup", "BrowserMainLoop::MainMessageLoopStart"); | 646 TRACE_EVENT0("startup", "BrowserMainLoop::MainMessageLoopStart"); |
| 643 | 647 |
| 644 // Create a MessageLoop if one does not already exist for the current thread. | 648 // Create a MessageLoop if one does not already exist for the current thread. |
| 645 if (!base::MessageLoop::current()) | 649 if (!base::MessageLoop::current()) |
| 646 main_message_loop_.reset(new base::MessageLoopForUI); | 650 main_message_loop_.reset(new base::MessageLoopForUI); |
| 647 | 651 |
| 648 InitializeMainThread(); | 652 InitializeMainThread(); |
| 653 #if defined(USE_OZONE) | |
| 654 DCHECK(env_); | |
| 655 if (env_->mode() == aura::Env::Mode::LOCAL) { | |
| 656 DCHECK(ui::OzonePlatform::GetInstance()); | |
| 657 ui::OzonePlatform::GetInstance() | |
| 658 ->GetGpuPlatformSupportHost() | |
| 659 ->BindToCurrentThread(); | |
|
jam
2017/04/20 00:22:20
why not just pass in the UI thread's task runner i
sadrul
2017/04/20 03:10:31
Yep, that also works. Done.
| |
| 660 } | |
| 661 #endif | |
| 649 } | 662 } |
| 650 | 663 |
| 651 void BrowserMainLoop::PostMainMessageLoopStart() { | 664 void BrowserMainLoop::PostMainMessageLoopStart() { |
| 652 { | 665 { |
| 653 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor"); | 666 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor"); |
| 654 system_monitor_.reset(new base::SystemMonitor); | 667 system_monitor_.reset(new base::SystemMonitor); |
| 655 } | 668 } |
| 656 { | 669 { |
| 657 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PowerMonitor"); | 670 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PowerMonitor"); |
| 658 std::unique_ptr<base::PowerMonitorSource> power_monitor_source( | 671 std::unique_ptr<base::PowerMonitorSource> power_monitor_source( |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1749 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 1762 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
| 1750 MediaInternals::GetInstance()); | 1763 MediaInternals::GetInstance()); |
| 1751 } | 1764 } |
| 1752 CHECK(audio_manager_); | 1765 CHECK(audio_manager_); |
| 1753 | 1766 |
| 1754 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1767 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
| 1755 CHECK(audio_system_); | 1768 CHECK(audio_system_); |
| 1756 } | 1769 } |
| 1757 | 1770 |
| 1758 } // namespace content | 1771 } // namespace content |
| OLD | NEW |