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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 #include "content/public/browser/tracing_controller.h" | 87 #include "content/public/browser/tracing_controller.h" |
88 #include "content/public/common/content_client.h" | 88 #include "content/public/common/content_client.h" |
89 #include "content/public/common/content_features.h" | 89 #include "content/public/common/content_features.h" |
90 #include "content/public/common/content_switches.h" | 90 #include "content/public/common/content_switches.h" |
91 #include "content/public/common/main_function_params.h" | 91 #include "content/public/common/main_function_params.h" |
92 #include "content/public/common/result_codes.h" | 92 #include "content/public/common/result_codes.h" |
93 #include "device/battery/battery_status_service.h" | 93 #include "device/battery/battery_status_service.h" |
94 #include "device/gamepad/gamepad_service.h" | 94 #include "device/gamepad/gamepad_service.h" |
95 #include "media/base/media.h" | 95 #include "media/base/media.h" |
96 #include "media/base/user_input_monitor.h" | 96 #include "media/base/user_input_monitor.h" |
97 #include "media/base/video_facing.h" | |
97 #include "media/midi/midi_service.h" | 98 #include "media/midi/midi_service.h" |
98 #include "mojo/edk/embedder/embedder.h" | 99 #include "mojo/edk/embedder/embedder.h" |
99 #include "mojo/edk/embedder/scoped_ipc_support.h" | 100 #include "mojo/edk/embedder/scoped_ipc_support.h" |
100 #include "net/base/network_change_notifier.h" | 101 #include "net/base/network_change_notifier.h" |
101 #include "net/socket/client_socket_factory.h" | 102 #include "net/socket/client_socket_factory.h" |
102 #include "net/ssl/ssl_config_service.h" | 103 #include "net/ssl/ssl_config_service.h" |
103 #include "ppapi/features/features.h" | 104 #include "ppapi/features/features.h" |
104 #include "services/service_manager/runner/common/client_util.h" | 105 #include "services/service_manager/runner/common/client_util.h" |
105 #include "skia/ext/event_tracer_impl.h" | 106 #include "skia/ext/event_tracer_impl.h" |
106 #include "skia/ext/skia_memory_dump_provider.h" | 107 #include "skia/ext/skia_memory_dump_provider.h" |
(...skipping 48 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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1150 #if defined(OS_ANDROID) | 1152 #if defined(OS_ANDROID) |
1151 // Let screen instance be overridable by parts. | 1153 // Let screen instance be overridable by parts. |
1152 ui::SetScreenAndroid(); | 1154 ui::SetScreenAndroid(); |
1153 #endif | 1155 #endif |
1154 | 1156 |
1155 if (parts_) { | 1157 if (parts_) { |
1156 TRACE_EVENT0("startup", | 1158 TRACE_EVENT0("startup", |
1157 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); | 1159 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); |
1158 | 1160 |
1159 parts_->PreMainMessageLoopRun(); | 1161 parts_->PreMainMessageLoopRun(); |
1162 | |
1163 #if defined(OS_CHROMEOS) | |
1164 if (chromeos::CrasAudioHandler::IsInitialized()) { | |
1165 if (media_stream_manager_.get() != NULL) { | |
1166 media_stream_manager_->SetVideoCaptureObserver( | |
1167 std::unique_ptr<media::VideoCaptureObserver>( | |
1168 new media::VideoCaptureObserverAdapter( | |
chfremer
2017/01/30 19:49:28
We should use base::MakeUnique<> here.
shenghao
2017/02/08 02:07:10
Done.
| |
1169 static_cast<chromeos::VideoCaptureObserver*>( | |
chfremer
2017/01/30 19:49:28
I don't think the compiler needs this cast, and I
shenghao
2017/02/08 02:07:10
Done.
| |
1170 chromeos::CrasAudioHandler::Get())))); | |
1171 } else { | |
1172 DLOG(ERROR) << "media_stream_manager_ is null."; | |
1173 } | |
1174 } else { | |
1175 DLOG(ERROR) << "CrasAudioHandler is not initialized."; | |
1176 } | |
1177 #endif | |
1160 } | 1178 } |
1161 | 1179 |
1162 // If the UI thread blocks, the whole UI is unresponsive. | 1180 // If the UI thread blocks, the whole UI is unresponsive. |
1163 // Do not allow disk IO from the UI thread. | 1181 // Do not allow disk IO from the UI thread. |
1164 base::ThreadRestrictions::SetIOAllowed(false); | 1182 base::ThreadRestrictions::SetIOAllowed(false); |
1165 base::ThreadRestrictions::DisallowWaiting(); | 1183 base::ThreadRestrictions::DisallowWaiting(); |
1166 return result_code_; | 1184 return result_code_; |
1167 } | 1185 } |
1168 | 1186 |
1169 void BrowserMainLoop::RunMainMessageLoopParts() { | 1187 void BrowserMainLoop::RunMainMessageLoopParts() { |
(...skipping 29 matching lines...) Expand all Loading... | |
1199 #if defined(OS_ANDROID) | 1217 #if defined(OS_ANDROID) |
1200 g_browser_main_loop_shutting_down = true; | 1218 g_browser_main_loop_shutting_down = true; |
1201 #endif | 1219 #endif |
1202 | 1220 |
1203 if (RenderProcessHost::run_renderer_in_process()) | 1221 if (RenderProcessHost::run_renderer_in_process()) |
1204 RenderProcessHostImpl::ShutDownInProcessRenderer(); | 1222 RenderProcessHostImpl::ShutDownInProcessRenderer(); |
1205 | 1223 |
1206 if (parts_) { | 1224 if (parts_) { |
1207 TRACE_EVENT0("shutdown", | 1225 TRACE_EVENT0("shutdown", |
1208 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 1226 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
1227 media_stream_manager_->SetVideoCaptureObserver( | |
1228 std::unique_ptr<media::VideoCaptureObserver>()); | |
chfremer
2017/01/30 19:49:28
media_stream_manager_->SetVideoCaptureObserver(nul
shenghao
2017/02/08 02:07:10
Done.
| |
1209 parts_->PostMainMessageLoopRun(); | 1229 parts_->PostMainMessageLoopRun(); |
1210 } | 1230 } |
1211 | 1231 |
1212 system_stats_monitor_.reset(); | 1232 system_stats_monitor_.reset(); |
1213 | 1233 |
1214 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 1234 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
1215 // delete related objects on the GPU thread. This must be done before | 1235 // delete related objects on the GPU thread. This must be done before |
1216 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 1236 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
1217 // processes so this has to happen before stopping the IO thread. | 1237 // processes so this has to happen before stopping the IO thread. |
1218 { | 1238 { |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1786 if (!audio_manager_) { | 1806 if (!audio_manager_) { |
1787 audio_thread_ = base::MakeUnique<AudioManagerThread>(); | 1807 audio_thread_ = base::MakeUnique<AudioManagerThread>(); |
1788 audio_manager_ = media::AudioManager::Create( | 1808 audio_manager_ = media::AudioManager::Create( |
1789 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1809 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
1790 MediaInternals::GetInstance()); | 1810 MediaInternals::GetInstance()); |
1791 } | 1811 } |
1792 CHECK(audio_manager_); | 1812 CHECK(audio_manager_); |
1793 } | 1813 } |
1794 | 1814 |
1795 } // namespace content | 1815 } // namespace content |
OLD | NEW |