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

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: address comments from patch 48 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 "net/base/network_change_notifier.h" 82 #include "net/base/network_change_notifier.h"
84 #include "net/socket/client_socket_factory.h" 83 #include "net/socket/client_socket_factory.h"
85 #include "net/ssl/ssl_config_service.h" 84 #include "net/ssl/ssl_config_service.h"
86 #include "skia/ext/event_tracer_impl.h" 85 #include "skia/ext/event_tracer_impl.h"
87 #include "skia/ext/skia_memory_dump_provider.h" 86 #include "skia/ext/skia_memory_dump_provider.h"
88 #include "sql/sql_memory_dump_provider.h" 87 #include "sql/sql_memory_dump_provider.h"
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager", 1218 BrowserGpuMemoryBufferManager::current(), "BrowserGpuMemoryBufferManager",
1220 io_thread_->task_runner()); 1219 io_thread_->task_runner());
1221 #if defined(OS_ANDROID) 1220 #if defined(OS_ANDROID)
1222 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 1221 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
1223 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", 1222 tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics",
1224 nullptr); 1223 nullptr);
1225 #endif 1224 #endif
1226 1225
1227 { 1226 {
1228 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan"); 1227 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:AudioMan");
1229 audio_manager_.reset(media::AudioManager::CreateWithHangTimer( 1228 CreateAudioManager();
1230 MediaInternals::GetInstance(), io_thread_->task_runner()));
1231 } 1229 }
1232 1230
1233 { 1231 {
1234 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager"); 1232 TRACE_EVENT0("startup", "BrowserThreadsStarted::Subsystem:MidiManager");
1235 midi_manager_.reset(media::midi::MidiManager::Create()); 1233 midi_manager_.reset(media::midi::MidiManager::Create());
1236 } 1234 }
1237 1235
1238 #if defined(OS_WIN) 1236 #if defined(OS_WIN)
1239 system_message_window_.reset(new media::SystemMessageWindowWin); 1237 system_message_window_.reset(new media::SystemMessageWindowWin);
1240 #elif defined(OS_LINUX) && defined(USE_UDEV) 1238 #elif defined(OS_LINUX) && defined(USE_UDEV)
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 void BrowserMainLoop::EndStartupTracing() { 1446 void BrowserMainLoop::EndStartupTracing() {
1449 DCHECK(is_tracing_startup_for_duration_); 1447 DCHECK(is_tracing_startup_for_duration_);
1450 1448
1451 is_tracing_startup_for_duration_ = false; 1449 is_tracing_startup_for_duration_ = false;
1452 TracingController::GetInstance()->StopTracing( 1450 TracingController::GetInstance()->StopTracing(
1453 TracingController::CreateFileSink( 1451 TracingController::CreateFileSink(
1454 startup_trace_file_, 1452 startup_trace_file_,
1455 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1453 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1456 } 1454 }
1457 1455
1456 void BrowserMainLoop::CreateAudioManager() {
1457 DCHECK(!audio_thread_);
1458 DCHECK(!audio_manager_);
1459 // TODO(alokp): Allow content embedders to override the default
1460 // task runners by defining ContentBrowserClient::GetAudioTaskRunner.
1461 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner;
1462 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner;
1463 scoped_refptr<base::SingleThreadTaskRunner> monitor_task_runner;
1464 audio_thread_.reset(new base::Thread("AudioThread"));
1465 #if defined(OS_WIN)
1466 audio_thread_->init_com_with_mta(true);
1467 #endif // defined(OS_WIN)
1468 CHECK(audio_thread_->Start());
1469 #if defined(OS_MACOSX)
1470 // On Mac audio task runner must belong to the main thread.
1471 // See http://crbug.com/158170.
1472 // Since the audio thread is the UI thread, a hang monitor is not
1473 // necessary or recommended.
1474 audio_task_runner = base::ThreadTaskRunnerHandle::Get();
1475 worker_task_runner = audio_thread_->task_runner();
1476 #else
1477 audio_task_runner = audio_thread_->task_runner();
1478 worker_task_runner = audio_thread_->task_runner();
1479 monitor_task_runner = io_thread_->task_runner();
1480 #endif // defined(OS_MACOSX)
1481 audio_manager_ = media::AudioManager::Create(
1482 std::move(audio_task_runner), std::move(worker_task_runner),
1483 std::move(monitor_task_runner), MediaInternals::GetInstance());
1484 }
1485
1458 } // namespace content 1486 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/renderer_host/media/audio_input_device_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698