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

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: addressed comments 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
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager", 1215 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager",
1217 io_thread_->task_runner()); 1216 io_thread_->task_runner());
1218 #if defined(OS_ANDROID) 1217 #if defined(OS_ANDROID)
1219 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 1218 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
1220 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", 1219 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics",
1221 nullptr); 1220 nullptr);
1222 #endif 1221 #endif
1223 1222
1224 { 1223 {
1225 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan"); 1224 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan");
1226 audio_manager_.reset(media::AudioManager::CreateWithHangTimer( 1225 // TODO(alokp): Allow content embedders to override the default
1227 MediaInternals::GetInstance(), io_thread_->task_runner())); 1226 // task runners by defining ContentBrowserClient::GetAudioTaskRunner.
1227 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner;
1228 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner;
1229 scoped_refptr<base::SingleThreadTaskRunner> monitor_task_runner;
1230 audio_thread_.reset(new base::Thread("AudioThread"));
1231 #if defined(OS_WIN)
1232 audio_thread_->init_com_with_mta(true);
1233 #endif // defined(OS_WIN)
1234 CHECK(audio_thread_->Start());
DaleCurtis 2016/03/22 21:58:27 It's unfortunate that we'll always start this now,
alokp 2016/03/22 22:23:39 Yeah I could not think of a way to avoid this.
1235 media::AudioLogFactory* audio_log_factory = MediaInternals::GetInstance();
DaleCurtis 2016/03/22 21:58:27 Seems unnecessary to break this out. I'd just inli
alokp 2016/03/22 22:23:39 Done.
1236 #if defined(OS_MACOSX)
1237 // On Mac audio task runner must belong to the main thread.
1238 // See http://crbug.com/158170.
1239 // Since the audio thread is the UI thread, a hang monitor is not
1240 // necessary or recommended.
1241 audio_task_runner = base::ThreadTaskRunnerHandle::Get();
1242 worker_task_runner = audio_thread_->task_runner();
1243 #else
1244 audio_task_runner = audio_thread_->task_runner();
1245 worker_task_runner = audio_thread_->task_runner();
1246 monitor_task_runner = io_thread_->task_runner();
1247 #endif // defined(OS_MACOSX)
1248 audio_manager_ = media::AudioManager::Create(
1249 std::move(audio_task_runner), std::move(worker_task_runner),
1250 std::move(monitor_task_runner), audio_log_factory);
1228 } 1251 }
1229 1252
1230 { 1253 {
1231 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager"); 1254 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager");
1232 midi_manager_.reset(media::midi::MidiManager::Create()); 1255 midi_manager_.reset(media::midi::MidiManager::Create());
1233 } 1256 }
1234 1257
1235 #if defined(OS_WIN) 1258 #if defined(OS_WIN)
1236 system_message_window_.reset(new media::SystemMessageWindowWin); 1259 system_message_window_.reset(new media::SystemMessageWindowWin);
1237 #elif defined(OS_LINUX) && defined(USE_UDEV) 1260 #elif defined(OS_LINUX) && defined(USE_UDEV)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 DCHECK(is_tracing_startup_for_duration_); 1469 DCHECK(is_tracing_startup_for_duration_);
1447 1470
1448 is_tracing_startup_for_duration_ = false; 1471 is_tracing_startup_for_duration_ = false;
1449 TracingController::GetInstance()->StopTracing( 1472 TracingController::GetInstance()->StopTracing(
1450 TracingController::CreateFileSink( 1473 TracingController::CreateFileSink(
1451 startup_trace_file_, 1474 startup_trace_file_,
1452 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1475 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1453 } 1476 }
1454 1477
1455 } // namespace content 1478 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698