Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass task runners into AudioManager::Create Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/audio/BUILD.gn » ('j') | media/audio/audio_input_controller_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 // On Mac and windows, the monitor needs to be destroyed on the same thread 1039 // On Mac and windows, the monitor needs to be destroyed on the same thread
1040 // as they were created. On Linux, the monitor will be deleted when IO thread 1040 // as they were created. On Linux, the monitor will be deleted when IO thread
1041 // goes away. 1041 // goes away.
1042 #if defined(OS_WIN) 1042 #if defined(OS_WIN)
1043 system_message_window_.reset(); 1043 system_message_window_.reset();
1044 #elif defined(OS_MACOSX) 1044 #elif defined(OS_MACOSX)
1045 device_monitor_mac_.reset(); 1045 device_monitor_mac_.reset();
1046 #endif 1046 #endif
1047 #endif // !defined(OS_IOS) 1047 #endif // !defined(OS_IOS)
1048 1048
1049 // Destroy audio_manager_ on audio thread.
DaleCurtis 2016/03/18 17:48:18 Be careful here, this changes the destruction orde
alokp 2016/03/18 18:40:06 Yeah I need to cycle this through the trybots.
1050 AudioManager::Destroy(audio_manager_.release());
1051
1049 // Shutdown Mojo shell and IPC. 1052 // Shutdown Mojo shell and IPC.
1050 #if !defined(OS_IOS) 1053 #if !defined(OS_IOS)
1051 mojo_shell_context_.reset(); 1054 mojo_shell_context_.reset();
1052 mojo_ipc_support_.reset(); 1055 mojo_ipc_support_.reset();
1053 #endif 1056 #endif
1054 1057
1055 // Must be size_t so we can subtract from it. 1058 // Must be size_t so we can subtract from it.
1056 for (size_t thread_id = BrowserThread::ID_COUNT - 1; 1059 for (size_t thread_id = BrowserThread::ID_COUNT - 1;
1057 thread_id >= (BrowserThread::UI + 1); 1060 thread_id >= (BrowserThread::UI + 1);
1058 --thread_id) { 1061 --thread_id) {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager", 1252 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager",
1250 io_thread_->task_runner()); 1253 io_thread_->task_runner());
1251 #if defined(OS_ANDROID) 1254 #if defined(OS_ANDROID)
1252 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 1255 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
1253 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", 1256 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics",
1254 nullptr); 1257 nullptr);
1255 #endif 1258 #endif
1256 1259
1257 { 1260 {
1258 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan"); 1261 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan");
1259 audio_manager_.reset(media::AudioManager::CreateWithHangTimer( 1262 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner;
DaleCurtis 2016/03/18 17:48:18 What will this code look like for cast?
alokp 2016/03/18 18:40:06 Since BML is common for all platforms/content-embe
1260 MediaInternals::GetInstance(), io_thread_->task_runner())); 1263 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner;
1264 scoped_refptr<base::SingleThreadTaskRunner> monitor_task_runner;
1265 AudioLogFactory* audio_log_factory = MediaInternals::GetInstance();
1266 #if defined(OS_MACOSX)
1267 // CoreAudio calls must occur on the main thread of the process, which in
1268 // our case is sadly the browser UI thread. Failure to execute calls on the
1269 // right thread leads to crashes and odd behavior.
1270 // See http://crbug.com/158170.
1271 // Since the audio thread is the UI thread, a hang monitor is not
1272 // necessary or recommended.
1273 audio_task_runner = base::ThreadTaskRunnerHandle::Get();
1274 #else
1275 monitor_task_runner = io_thread_->task_runner();
1276 #endif
1277 audio_manager_.reset(
1278 media::AudioManager::Create(audio_task_runner, worker_task_runner,
1279 monitor_task_runner, audio_log_factory));
1261 } 1280 }
1262 1281
1263 { 1282 {
1264 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager"); 1283 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager");
1265 midi_manager_.reset(media::midi::MidiManager::Create()); 1284 midi_manager_.reset(media::midi::MidiManager::Create());
1266 } 1285 }
1267 1286
1268 #if defined(OS_WIN) 1287 #if defined(OS_WIN)
1269 system_message_window_.reset(new media::SystemMessageWindowWin); 1288 system_message_window_.reset(new media::SystemMessageWindowWin);
1270 #elif defined(OS_LINUX) && defined(USE_UDEV) 1289 #elif defined(OS_LINUX) && defined(USE_UDEV)
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 DCHECK(is_tracing_startup_for_duration_); 1500 DCHECK(is_tracing_startup_for_duration_);
1482 1501
1483 is_tracing_startup_for_duration_ = false; 1502 is_tracing_startup_for_duration_ = false;
1484 TracingController::GetInstance()->StopTracing( 1503 TracingController::GetInstance()->StopTracing(
1485 TracingController::CreateFileSink( 1504 TracingController::CreateFileSink(
1486 startup_trace_file_, 1505 startup_trace_file_,
1487 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1506 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1488 } 1507 }
1489 1508
1490 } // namespace content 1509 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/audio/BUILD.gn » ('j') | media/audio/audio_input_controller_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698