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

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

Issue 2443573003: Factor out AudioOutputDelegate from AudioRendererHost. (Closed)
Patch Set: . Created 4 years 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 <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 25 matching lines...) Expand all
36 #include "base/threading/thread_task_runner_handle.h" 36 #include "base/threading/thread_task_runner_handle.h"
37 #include "base/timer/hi_res_timer_manager.h" 37 #include "base/timer/hi_res_timer_manager.h"
38 #include "base/trace_event/memory_dump_manager.h" 38 #include "base/trace_event/memory_dump_manager.h"
39 #include "base/trace_event/trace_event.h" 39 #include "base/trace_event/trace_event.h"
40 #include "build/build_config.h" 40 #include "build/build_config.h"
41 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h" 41 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h"
42 #include "components/tracing/browser/trace_config_file.h" 42 #include "components/tracing/browser/trace_config_file.h"
43 #include "components/tracing/common/process_metrics_memory_dump_provider.h" 43 #include "components/tracing/common/process_metrics_memory_dump_provider.h"
44 #include "components/tracing/common/trace_to_console.h" 44 #include "components/tracing/common/trace_to_console.h"
45 #include "components/tracing/common/tracing_switches.h" 45 #include "components/tracing/common/tracing_switches.h"
46 #include "content/browser/audio_device_thread.h"
46 #include "content/browser/browser_thread_impl.h" 47 #include "content/browser/browser_thread_impl.h"
47 #include "content/browser/device_sensors/device_sensor_service.h" 48 #include "content/browser/device_sensors/device_sensor_service.h"
48 #include "content/browser/dom_storage/dom_storage_area.h" 49 #include "content/browser/dom_storage/dom_storage_area.h"
49 #include "content/browser/download/download_resource_handler.h" 50 #include "content/browser/download/download_resource_handler.h"
50 #include "content/browser/download/save_file_manager.h" 51 #include "content/browser/download/save_file_manager.h"
51 #include "content/browser/gamepad/gamepad_service.h" 52 #include "content/browser/gamepad/gamepad_service.h"
52 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 53 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
53 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 54 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
54 #include "content/browser/gpu/compositor_util.h" 55 #include "content/browser/gpu/compositor_util.h"
55 #include "content/browser/gpu/gpu_data_manager_impl.h" 56 #include "content/browser/gpu/gpu_data_manager_impl.h"
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1603 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1603 } 1604 }
1604 1605
1605 void BrowserMainLoop::CreateAudioManager() { 1606 void BrowserMainLoop::CreateAudioManager() {
1606 DCHECK(!audio_thread_); 1607 DCHECK(!audio_thread_);
1607 DCHECK(!audio_manager_); 1608 DCHECK(!audio_manager_);
1608 1609
1609 audio_manager_ = GetContentClient()->browser()->CreateAudioManager( 1610 audio_manager_ = GetContentClient()->browser()->CreateAudioManager(
1610 MediaInternals::GetInstance()); 1611 MediaInternals::GetInstance());
1611 if (!audio_manager_) { 1612 if (!audio_manager_) {
1612 audio_thread_.reset(new base::Thread("AudioThread")); 1613 audio_thread_ = base::MakeUnique<AudioDeviceThread>();
1613 #if defined(OS_WIN) 1614 audio_manager_ = media::AudioManager::Create(
o1ka 2016/12/02 13:01:46 nice!
1614 audio_thread_->init_com_with_mta(true); 1615 audio_thread_->task_runner(), audio_thread_->worker_task_runner(),
1615 #endif // defined(OS_WIN) 1616 MediaInternals::GetInstance());
1616 CHECK(audio_thread_->Start());
1617 #if defined(OS_MACOSX)
1618 // On Mac audio task runner must belong to the main thread.
1619 // See http://crbug.com/158170.
1620 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner =
1621 base::ThreadTaskRunnerHandle::Get();
1622 #else
1623 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner =
1624 audio_thread_->task_runner();
1625 #endif // defined(OS_MACOSX)
1626 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner =
1627 audio_thread_->task_runner();
1628 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner),
1629 std::move(worker_task_runner),
1630 MediaInternals::GetInstance());
1631 } 1617 }
1632 CHECK(audio_manager_); 1618 CHECK(audio_manager_);
1633 } 1619 }
1634 1620
1635 } // namespace content 1621 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698