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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 #include "content/common/mojo/mojo_shell_connection_impl.h" | 66 #include "content/common/mojo/mojo_shell_connection_impl.h" |
67 #include "content/public/browser/browser_main_parts.h" | 67 #include "content/public/browser/browser_main_parts.h" |
68 #include "content/public/browser/content_browser_client.h" | 68 #include "content/public/browser/content_browser_client.h" |
69 #include "content/public/browser/render_process_host.h" | 69 #include "content/public/browser/render_process_host.h" |
70 #include "content/public/browser/tracing_controller.h" | 70 #include "content/public/browser/tracing_controller.h" |
71 #include "content/public/common/content_switches.h" | 71 #include "content/public/common/content_switches.h" |
72 #include "content/public/common/main_function_params.h" | 72 #include "content/public/common/main_function_params.h" |
73 #include "content/public/common/result_codes.h" | 73 #include "content/public/common/result_codes.h" |
74 #include "device/battery/battery_status_service.h" | 74 #include "device/battery/battery_status_service.h" |
75 #include "ipc/mojo/scoped_ipc_support.h" | 75 #include "ipc/mojo/scoped_ipc_support.h" |
76 #include "media/audio/audio_manager.h" | |
77 #include "media/base/media.h" | 76 #include "media/base/media.h" |
78 #include "media/base/user_input_monitor.h" | 77 #include "media/base/user_input_monitor.h" |
79 #include "media/midi/midi_manager.h" | 78 #include "media/midi/midi_manager.h" |
80 #include "mojo/edk/embedder/embedder.h" | 79 #include "mojo/edk/embedder/embedder.h" |
81 #include "mojo/shell/public/cpp/shell.h" | 80 #include "mojo/shell/public/cpp/shell.h" |
82 #include "net/base/network_change_notifier.h" | 81 #include "net/base/network_change_notifier.h" |
83 #include "net/socket/client_socket_factory.h" | 82 #include "net/socket/client_socket_factory.h" |
84 #include "net/ssl/ssl_config_service.h" | 83 #include "net/ssl/ssl_config_service.h" |
85 #include "skia/ext/event_tracer_impl.h" | 84 #include "skia/ext/event_tracer_impl.h" |
86 #include "skia/ext/skia_memory_dump_provider.h" | 85 #include "skia/ext/skia_memory_dump_provider.h" |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1249 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager", | 1248 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager", |
1250 io_thread_->task_runner()); | 1249 io_thread_->task_runner()); |
1251 #if defined(OS_ANDROID) | 1250 #if defined(OS_ANDROID) |
1252 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 1251 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
1253 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", | 1252 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", |
1254 nullptr); | 1253 nullptr); |
1255 #endif | 1254 #endif |
1256 | 1255 |
1257 { | 1256 { |
1258 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan"); | 1257 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan"); |
1259 audio_manager_.reset(media::AudioManager::CreateWithHangTimer( | 1258 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner; |
1260 MediaInternals::GetInstance(), io_thread_->task_runner())); | 1259 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner; |
1260 scoped_refptr<base::SingleThreadTaskRunner> monitor_task_runner; | |
1261 media::AudioLogFactory* audio_log_factory = MediaInternals::GetInstance(); | |
1262 #if defined(OS_MACOSX) | |
1263 // CoreAudio calls must occur on the main thread of the process, which in | |
1264 // our case is sadly the browser UI thread. Failure to execute calls on the | |
1265 // right thread leads to crashes and odd behavior. | |
1266 // See http://crbug.com/158170. | |
1267 // Since the audio thread is the UI thread, a hang monitor is not | |
1268 // necessary or recommended. | |
1269 audio_task_runner = base::ThreadTaskRunnerHandle::Get(); | |
1270 #else | |
1271 monitor_task_runner = io_thread_->task_runner(); | |
1272 #endif | |
1273 audio_manager_ = | |
1274 media::AudioManager::Create(audio_task_runner, worker_task_runner, | |
tommi (sloooow) - chröme
2016/03/19 02:32:41
nit: since these are going out of scope and Create
alokp
2016/03/22 21:47:06
I think we need to pass the ownership to match the
| |
1275 monitor_task_runner, audio_log_factory); | |
1261 } | 1276 } |
1262 | 1277 |
1263 { | 1278 { |
1264 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager"); | 1279 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager"); |
1265 midi_manager_.reset(media::midi::MidiManager::Create()); | 1280 midi_manager_.reset(media::midi::MidiManager::Create()); |
1266 } | 1281 } |
1267 | 1282 |
1268 #if defined(OS_WIN) | 1283 #if defined(OS_WIN) |
1269 system_message_window_.reset(new media::SystemMessageWindowWin); | 1284 system_message_window_.reset(new media::SystemMessageWindowWin); |
1270 #elif defined(OS_LINUX) && defined(USE_UDEV) | 1285 #elif defined(OS_LINUX) && defined(USE_UDEV) |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1481 DCHECK(is_tracing_startup_for_duration_); | 1496 DCHECK(is_tracing_startup_for_duration_); |
1482 | 1497 |
1483 is_tracing_startup_for_duration_ = false; | 1498 is_tracing_startup_for_duration_ = false; |
1484 TracingController::GetInstance()->StopTracing( | 1499 TracingController::GetInstance()->StopTracing( |
1485 TracingController::CreateFileSink( | 1500 TracingController::CreateFileSink( |
1486 startup_trace_file_, | 1501 startup_trace_file_, |
1487 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1502 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1488 } | 1503 } |
1489 | 1504 |
1490 } // namespace content | 1505 } // namespace content |
OLD | NEW |