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