| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 #include "base/memory/memory_pressure_monitor_win.h" | 157 #include "base/memory/memory_pressure_monitor_win.h" |
| 157 #include "base/win/windows_version.h" | 158 #include "base/win/windows_version.h" |
| 158 #include "content/browser/screen_orientation/screen_orientation_delegate_win.h" | 159 #include "content/browser/screen_orientation/screen_orientation_delegate_win.h" |
| 159 #include "content/common/sandbox_win.h" | 160 #include "content/common/sandbox_win.h" |
| 160 #include "net/base/winsock_init.h" | 161 #include "net/base/winsock_init.h" |
| 161 #include "ui/base/l10n/l10n_util_win.h" | 162 #include "ui/base/l10n/l10n_util_win.h" |
| 162 #endif | 163 #endif |
| 163 | 164 |
| 164 #if defined(OS_CHROMEOS) | 165 #if defined(OS_CHROMEOS) |
| 165 #include "base/memory/memory_pressure_monitor_chromeos.h" | 166 #include "base/memory/memory_pressure_monitor_chromeos.h" |
| 167 #include "chromeos/audio/cras_audio_handler.h" |
| 166 #include "chromeos/chromeos_switches.h" | 168 #include "chromeos/chromeos_switches.h" |
| 169 #include "media/capture/video/linux/video_capture_observer_chromeos.h" |
| 167 #endif | 170 #endif |
| 168 | 171 |
| 169 #if defined(USE_GLIB) | 172 #if defined(USE_GLIB) |
| 170 #include <glib-object.h> | 173 #include <glib-object.h> |
| 171 #endif | 174 #endif |
| 172 | 175 |
| 173 #if defined(OS_WIN) | 176 #if defined(OS_WIN) |
| 174 #include "media/device_monitors/system_message_window_win.h" | 177 #include "media/device_monitors/system_message_window_win.h" |
| 175 #elif defined(OS_LINUX) && defined(USE_UDEV) | 178 #elif defined(OS_LINUX) && defined(USE_UDEV) |
| 176 #include "media/device_monitors/device_monitor_udev.h" | 179 #include "media/device_monitors/device_monitor_udev.h" |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 #if defined(OS_ANDROID) | 1160 #if defined(OS_ANDROID) |
| 1158 // Let screen instance be overridable by parts. | 1161 // Let screen instance be overridable by parts. |
| 1159 ui::SetScreenAndroid(); | 1162 ui::SetScreenAndroid(); |
| 1160 #endif | 1163 #endif |
| 1161 | 1164 |
| 1162 if (parts_) { | 1165 if (parts_) { |
| 1163 TRACE_EVENT0("startup", | 1166 TRACE_EVENT0("startup", |
| 1164 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); | 1167 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); |
| 1165 | 1168 |
| 1166 parts_->PreMainMessageLoopRun(); | 1169 parts_->PreMainMessageLoopRun(); |
| 1170 |
| 1171 #if defined(OS_CHROMEOS) |
| 1172 if (chromeos::CrasAudioHandler::IsInitialized()) { |
| 1173 if (media_stream_manager_.get() != NULL) { |
| 1174 media_stream_manager_->SetVideoCaptureObserver( |
| 1175 base::MakeUnique<media::VideoCaptureObserverChromeOS>( |
| 1176 chromeos::CrasAudioHandler::Get())); |
| 1177 } else { |
| 1178 DLOG(ERROR) << "media_stream_manager_ is null."; |
| 1179 } |
| 1180 } else { |
| 1181 DLOG(ERROR) << "CrasAudioHandler is not initialized."; |
| 1182 } |
| 1183 #endif |
| 1167 } | 1184 } |
| 1168 | 1185 |
| 1169 // If the UI thread blocks, the whole UI is unresponsive. | 1186 // If the UI thread blocks, the whole UI is unresponsive. |
| 1170 // Do not allow disk IO from the UI thread. | 1187 // Do not allow disk IO from the UI thread. |
| 1171 base::ThreadRestrictions::SetIOAllowed(false); | 1188 base::ThreadRestrictions::SetIOAllowed(false); |
| 1172 base::ThreadRestrictions::DisallowWaiting(); | 1189 base::ThreadRestrictions::DisallowWaiting(); |
| 1173 return result_code_; | 1190 return result_code_; |
| 1174 } | 1191 } |
| 1175 | 1192 |
| 1176 void BrowserMainLoop::RunMainMessageLoopParts() { | 1193 void BrowserMainLoop::RunMainMessageLoopParts() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1206 #if defined(OS_ANDROID) | 1223 #if defined(OS_ANDROID) |
| 1207 g_browser_main_loop_shutting_down = true; | 1224 g_browser_main_loop_shutting_down = true; |
| 1208 #endif | 1225 #endif |
| 1209 | 1226 |
| 1210 if (RenderProcessHost::run_renderer_in_process()) | 1227 if (RenderProcessHost::run_renderer_in_process()) |
| 1211 RenderProcessHostImpl::ShutDownInProcessRenderer(); | 1228 RenderProcessHostImpl::ShutDownInProcessRenderer(); |
| 1212 | 1229 |
| 1213 if (parts_) { | 1230 if (parts_) { |
| 1214 TRACE_EVENT0("shutdown", | 1231 TRACE_EVENT0("shutdown", |
| 1215 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 1232 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
| 1233 media_stream_manager_->SetVideoCaptureObserver(nullptr); |
| 1216 parts_->PostMainMessageLoopRun(); | 1234 parts_->PostMainMessageLoopRun(); |
| 1217 } | 1235 } |
| 1218 | 1236 |
| 1219 system_stats_monitor_.reset(); | 1237 system_stats_monitor_.reset(); |
| 1220 | 1238 |
| 1221 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 1239 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
| 1222 // delete related objects on the GPU thread. This must be done before | 1240 // delete related objects on the GPU thread. This must be done before |
| 1223 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 1241 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
| 1224 // processes so this has to happen before stopping the IO thread. | 1242 // processes so this has to happen before stopping the IO thread. |
| 1225 { | 1243 { |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1817 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
| 1800 MediaInternals::GetInstance()); | 1818 MediaInternals::GetInstance()); |
| 1801 } | 1819 } |
| 1802 CHECK(audio_manager_); | 1820 CHECK(audio_manager_); |
| 1803 | 1821 |
| 1804 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1822 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
| 1805 CHECK(audio_system_); | 1823 CHECK(audio_system_); |
| 1806 } | 1824 } |
| 1807 | 1825 |
| 1808 } // namespace content | 1826 } // namespace content |
| OLD | NEW |