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

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: DCHECK -> CHECK Created 4 years, 8 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 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "content/common/mojo/mojo_shell_connection_impl.h" 68 #include "content/common/mojo/mojo_shell_connection_impl.h"
69 #include "content/public/browser/browser_main_parts.h" 69 #include "content/public/browser/browser_main_parts.h"
70 #include "content/public/browser/content_browser_client.h" 70 #include "content/public/browser/content_browser_client.h"
71 #include "content/public/browser/render_process_host.h" 71 #include "content/public/browser/render_process_host.h"
72 #include "content/public/browser/tracing_controller.h" 72 #include "content/public/browser/tracing_controller.h"
73 #include "content/public/common/content_switches.h" 73 #include "content/public/common/content_switches.h"
74 #include "content/public/common/main_function_params.h" 74 #include "content/public/common/main_function_params.h"
75 #include "content/public/common/result_codes.h" 75 #include "content/public/common/result_codes.h"
76 #include "device/battery/battery_status_service.h" 76 #include "device/battery/battery_status_service.h"
77 #include "ipc/mojo/scoped_ipc_support.h" 77 #include "ipc/mojo/scoped_ipc_support.h"
78 #include "media/audio/audio_manager.h"
79 #include "media/base/media.h" 78 #include "media/base/media.h"
80 #include "media/base/user_input_monitor.h" 79 #include "media/base/user_input_monitor.h"
81 #include "media/midi/midi_manager.h" 80 #include "media/midi/midi_manager.h"
82 #include "mojo/edk/embedder/embedder.h" 81 #include "mojo/edk/embedder/embedder.h"
83 #include "mojo/shell/public/cpp/shell.h" 82 #include "mojo/shell/public/cpp/shell.h"
84 #include "net/base/network_change_notifier.h" 83 #include "net/base/network_change_notifier.h"
85 #include "net/socket/client_socket_factory.h" 84 #include "net/socket/client_socket_factory.h"
86 #include "net/ssl/ssl_config_service.h" 85 #include "net/ssl/ssl_config_service.h"
87 #include "skia/ext/event_tracer_impl.h" 86 #include "skia/ext/event_tracer_impl.h"
88 #include "skia/ext/skia_memory_dump_provider.h" 87 #include "skia/ext/skia_memory_dump_provider.h"
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager", 1220 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager",
1222 io_thread_->task_runner()); 1221 io_thread_->task_runner());
1223 #if defined(OS_ANDROID) 1222 #if defined(OS_ANDROID)
1224 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 1223 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
1225 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", 1224 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics",
1226 nullptr); 1225 nullptr);
1227 #endif 1226 #endif
1228 1227
1229 { 1228 {
1230 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan"); 1229 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan");
1231 audio_manager_.reset(media::AudioManager::CreateWithHangTimer( 1230 // TODO(alokp): Allow content embedders to override the default
tommi (sloooow) - chröme 2016/04/13 07:31:51 nit: in order to keep the size of BrowserThreadsSt
alokp 2016/04/17 16:55:19 Done.
1232 MediaInternals::GetInstance(), io_thread_->task_runner())); 1231 // task runners by defining ContentBrowserClient::GetAudioTaskRunner.
1232 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner;
1233 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner;
1234 scoped_refptr<base::SingleThreadTaskRunner> monitor_task_runner;
1235 audio_thread_.reset(new base::Thread("AudioThread"));
1236 #if defined(OS_WIN)
1237 audio_thread_->init_com_with_mta(true);
1238 #endif // defined(OS_WIN)
1239 CHECK(audio_thread_->Start());
1240 #if defined(OS_MACOSX)
1241 // On Mac audio task runner must belong to the main thread.
1242 // See http://crbug.com/158170.
1243 // Since the audio thread is the UI thread, a hang monitor is not
1244 // necessary or recommended.
1245 audio_task_runner = base::ThreadTaskRunnerHandle::Get();
1246 worker_task_runner = audio_thread_->task_runner();
1247 #else
1248 audio_task_runner = audio_thread_->task_runner();
1249 worker_task_runner = audio_thread_->task_runner();
1250 monitor_task_runner = io_thread_->task_runner();
1251 #endif // defined(OS_MACOSX)
1252 audio_manager_ = media::AudioManager::Create(
1253 std::move(audio_task_runner), std::move(worker_task_runner),
1254 std::move(monitor_task_runner), MediaInternals::GetInstance());
1233 } 1255 }
1234 1256
1235 { 1257 {
1236 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager"); 1258 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager");
1237 midi_manager_.reset(media::midi::MidiManager::Create()); 1259 midi_manager_.reset(media::midi::MidiManager::Create());
1238 } 1260 }
1239 1261
1240 #if defined(OS_WIN) 1262 #if defined(OS_WIN)
1241 system_message_window_.reset(new media::SystemMessageWindowWin); 1263 system_message_window_.reset(new media::SystemMessageWindowWin);
1242 #elif defined(OS_LINUX) && defined(USE_UDEV) 1264 #elif defined(OS_LINUX) && defined(USE_UDEV)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 DCHECK(is_tracing_startup_for_duration_); 1473 DCHECK(is_tracing_startup_for_duration_);
1452 1474
1453 is_tracing_startup_for_duration_ = false; 1475 is_tracing_startup_for_duration_ = false;
1454 TracingController::GetInstance()->StopTracing( 1476 TracingController::GetInstance()->StopTracing(
1455 TracingController::CreateFileSink( 1477 TracingController::CreateFileSink(
1456 startup_trace_file_, 1478 startup_trace_file_,
1457 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1479 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1458 } 1480 }
1459 1481
1460 } // namespace content 1482 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698