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

Side by Side Diff: media/audio/audio_thread_impl.cc

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: addressed comments Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/audio_manager_thread.h" 5 #include "media/audio/audio_thread_impl.h"
6 6
7 #include "base/threading/thread_task_runner_handle.h" 7 #include "base/threading/thread_task_runner_handle.h"
8 #include "build/build_config.h"
9 8
10 namespace content { 9 namespace media {
11 10
12 AudioManagerThread::AudioManagerThread() : thread_("AudioThread") { 11 AudioThreadImpl::AudioThreadImpl() : thread_("AudioThread") {
13 #if defined(OS_WIN) 12 #if defined(OS_WIN)
14 thread_.init_com_with_mta(true); 13 thread_.init_com_with_mta(true);
15 #endif 14 #endif
16 CHECK(thread_.Start()); 15 CHECK(thread_.Start());
17 16
18 #if defined(OS_MACOSX) 17 #if defined(OS_MACOSX)
19 // On Mac, the audio task runner must belong to the main thread. 18 // On Mac, the audio task runner must belong to the main thread.
20 // See http://crbug.com/158170. 19 // See http://crbug.com/158170.
21 task_runner_ = base::ThreadTaskRunnerHandle::Get(); 20 task_runner_ = base::ThreadTaskRunnerHandle::Get();
22 #else 21 #else
23 task_runner_ = thread_.task_runner(); 22 task_runner_ = thread_.task_runner();
24 #endif 23 #endif
24 worker_task_runner_ = thread_.task_runner();
25 } 25 }
26 26
27 AudioManagerThread::~AudioManagerThread() {} 27 AudioThreadImpl::~AudioThreadImpl() {}
o1ka 2017/05/10 15:57:57 DCHECK that it's called on |task_runner_| on Mac?
alokp 2017/05/10 18:04:03 I do not think we want to verify anything special
28 28
29 } // namespace content 29 void AudioThreadImpl::Stop() {
30 thread_.Stop();
31 }
32
33 base::SingleThreadTaskRunner* AudioThreadImpl::GetTaskRunner() {
34 return task_runner_.get();
35 }
36
37 base::SingleThreadTaskRunner* AudioThreadImpl::GetWorkerTaskRunner() {
38 return worker_task_runner_.get();
39 }
40
41 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698