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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 #include "content/public/common/content_features.h" | 88 #include "content/public/common/content_features.h" |
| 89 #include "content/public/common/content_switches.h" | 89 #include "content/public/common/content_switches.h" |
| 90 #include "content/public/common/main_function_params.h" | 90 #include "content/public/common/main_function_params.h" |
| 91 #include "content/public/common/result_codes.h" | 91 #include "content/public/common/result_codes.h" |
| 92 #include "device/battery/battery_status_service.h" | 92 #include "device/battery/battery_status_service.h" |
| 93 #include "device/gamepad/gamepad_service.h" | 93 #include "device/gamepad/gamepad_service.h" |
| 94 #include "device/sensors/device_sensor_service.h" | 94 #include "device/sensors/device_sensor_service.h" |
| 95 #include "media/audio/audio_system_impl.h" | 95 #include "media/audio/audio_system_impl.h" |
| 96 #include "media/base/media.h" | 96 #include "media/base/media.h" |
| 97 #include "media/base/user_input_monitor.h" | 97 #include "media/base/user_input_monitor.h" |
| 98 #include "media/base/video_facing.h" | |
| 98 #include "media/midi/midi_service.h" | 99 #include "media/midi/midi_service.h" |
| 99 #include "mojo/edk/embedder/embedder.h" | 100 #include "mojo/edk/embedder/embedder.h" |
| 100 #include "mojo/edk/embedder/scoped_ipc_support.h" | 101 #include "mojo/edk/embedder/scoped_ipc_support.h" |
| 101 #include "net/base/network_change_notifier.h" | 102 #include "net/base/network_change_notifier.h" |
| 102 #include "net/socket/client_socket_factory.h" | 103 #include "net/socket/client_socket_factory.h" |
| 103 #include "net/ssl/ssl_config_service.h" | 104 #include "net/ssl/ssl_config_service.h" |
| 104 #include "ppapi/features/features.h" | 105 #include "ppapi/features/features.h" |
| 105 #include "services/service_manager/runner/common/client_util.h" | 106 #include "services/service_manager/runner/common/client_util.h" |
| 106 #include "skia/ext/event_tracer_impl.h" | 107 #include "skia/ext/event_tracer_impl.h" |
| 107 #include "skia/ext/skia_memory_dump_provider.h" | 108 #include "skia/ext/skia_memory_dump_provider.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 #include "base/memory/memory_pressure_monitor_win.h" | 156 #include "base/memory/memory_pressure_monitor_win.h" |
| 156 #include "base/win/windows_version.h" | 157 #include "base/win/windows_version.h" |
| 157 #include "content/browser/screen_orientation/screen_orientation_delegate_win.h" | 158 #include "content/browser/screen_orientation/screen_orientation_delegate_win.h" |
| 158 #include "content/common/sandbox_win.h" | 159 #include "content/common/sandbox_win.h" |
| 159 #include "net/base/winsock_init.h" | 160 #include "net/base/winsock_init.h" |
| 160 #include "ui/base/l10n/l10n_util_win.h" | 161 #include "ui/base/l10n/l10n_util_win.h" |
| 161 #endif | 162 #endif |
| 162 | 163 |
| 163 #if defined(OS_CHROMEOS) | 164 #if defined(OS_CHROMEOS) |
| 164 #include "base/memory/memory_pressure_monitor_chromeos.h" | 165 #include "base/memory/memory_pressure_monitor_chromeos.h" |
| 166 #include "chromeos/audio/cras_audio_handler.h" | |
| 165 #include "chromeos/chromeos_switches.h" | 167 #include "chromeos/chromeos_switches.h" |
| 166 #endif | 168 #endif |
| 167 | 169 |
| 168 #if defined(USE_GLIB) | 170 #if defined(USE_GLIB) |
| 169 #include <glib-object.h> | 171 #include <glib-object.h> |
| 170 #endif | 172 #endif |
| 171 | 173 |
| 172 #if defined(OS_WIN) | 174 #if defined(OS_WIN) |
| 173 #include "media/device_monitors/system_message_window_win.h" | 175 #include "media/device_monitors/system_message_window_win.h" |
| 174 #elif defined(OS_LINUX) && defined(USE_UDEV) | 176 #elif defined(OS_LINUX) && defined(USE_UDEV) |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1154 #if defined(OS_ANDROID) | 1156 #if defined(OS_ANDROID) |
| 1155 // Let screen instance be overridable by parts. | 1157 // Let screen instance be overridable by parts. |
| 1156 ui::SetScreenAndroid(); | 1158 ui::SetScreenAndroid(); |
| 1157 #endif | 1159 #endif |
| 1158 | 1160 |
| 1159 if (parts_) { | 1161 if (parts_) { |
| 1160 TRACE_EVENT0("startup", | 1162 TRACE_EVENT0("startup", |
| 1161 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); | 1163 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); |
| 1162 | 1164 |
| 1163 parts_->PreMainMessageLoopRun(); | 1165 parts_->PreMainMessageLoopRun(); |
| 1166 | |
| 1167 #if defined(OS_CHROMEOS) | |
| 1168 if (chromeos::CrasAudioHandler::IsInitialized()) { | |
|
jochen (gone - plz use gerrit)
2017/02/21 11:37:24
please move this entire logic to chrome_browser_ma
shenghao
2017/02/21 21:41:15
Done.
| |
| 1169 if (media_stream_manager_) { | |
| 1170 BrowserThread::PostTask( | |
| 1171 BrowserThread::IO, FROM_HERE, | |
| 1172 base::Bind(&MediaStreamManager::AddVideoCaptureObserver, | |
| 1173 base::Unretained(media_stream_manager_.get()), | |
| 1174 chromeos::CrasAudioHandler::Get())); | |
| 1175 } else { | |
| 1176 DVLOG(3) << "media_stream_manager_ is null."; | |
| 1177 } | |
| 1178 } else { | |
| 1179 DVLOG(3) << "CrasAudioHandler is not initialized."; | |
| 1180 } | |
| 1181 #endif | |
| 1164 } | 1182 } |
| 1165 | 1183 |
| 1166 // If the UI thread blocks, the whole UI is unresponsive. | 1184 // If the UI thread blocks, the whole UI is unresponsive. |
| 1167 // Do not allow disk IO from the UI thread. | 1185 // Do not allow disk IO from the UI thread. |
| 1168 base::ThreadRestrictions::SetIOAllowed(false); | 1186 base::ThreadRestrictions::SetIOAllowed(false); |
| 1169 base::ThreadRestrictions::DisallowWaiting(); | 1187 base::ThreadRestrictions::DisallowWaiting(); |
| 1170 return result_code_; | 1188 return result_code_; |
| 1171 } | 1189 } |
| 1172 | 1190 |
| 1173 void BrowserMainLoop::RunMainMessageLoopParts() { | 1191 void BrowserMainLoop::RunMainMessageLoopParts() { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1203 #if defined(OS_ANDROID) | 1221 #if defined(OS_ANDROID) |
| 1204 g_browser_main_loop_shutting_down = true; | 1222 g_browser_main_loop_shutting_down = true; |
| 1205 #endif | 1223 #endif |
| 1206 | 1224 |
| 1207 if (RenderProcessHost::run_renderer_in_process()) | 1225 if (RenderProcessHost::run_renderer_in_process()) |
| 1208 RenderProcessHostImpl::ShutDownInProcessRenderer(); | 1226 RenderProcessHostImpl::ShutDownInProcessRenderer(); |
| 1209 | 1227 |
| 1210 if (parts_) { | 1228 if (parts_) { |
| 1211 TRACE_EVENT0("shutdown", | 1229 TRACE_EVENT0("shutdown", |
| 1212 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 1230 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
| 1231 BrowserThread::PostTask( | |
| 1232 BrowserThread::IO, FROM_HERE, | |
| 1233 base::Bind(&MediaStreamManager::RemoveAllVideoCaptureObservers, | |
| 1234 base::Unretained(media_stream_manager_.get()))); | |
| 1213 parts_->PostMainMessageLoopRun(); | 1235 parts_->PostMainMessageLoopRun(); |
| 1214 } | 1236 } |
| 1215 | 1237 |
| 1216 system_stats_monitor_.reset(); | 1238 system_stats_monitor_.reset(); |
| 1217 | 1239 |
| 1218 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 1240 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
| 1219 // delete related objects on the GPU thread. This must be done before | 1241 // delete related objects on the GPU thread. This must be done before |
| 1220 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 1242 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
| 1221 // processes so this has to happen before stopping the IO thread. | 1243 // processes so this has to happen before stopping the IO thread. |
| 1222 { | 1244 { |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1796 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1818 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
| 1797 MediaInternals::GetInstance()); | 1819 MediaInternals::GetInstance()); |
| 1798 } | 1820 } |
| 1799 CHECK(audio_manager_); | 1821 CHECK(audio_manager_); |
| 1800 | 1822 |
| 1801 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1823 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
| 1802 CHECK(audio_system_); | 1824 CHECK(audio_system_); |
| 1803 } | 1825 } |
| 1804 | 1826 |
| 1805 } // namespace content | 1827 } // namespace content |
| OLD | NEW |