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

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

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: cleanup 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/audio/test_audio_thread.h"
6
7 #include "base/run_loop.h"
8 #include "base/threading/thread_task_runner_handle.h"
9
10 namespace media {
11
12 TestAudioThread::TestAudioThread()
13 : task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
o1ka 2017/04/28 13:24:20 The purpose of this class needs to be explained in
alokp 2017/04/28 17:31:13 I will add more comments. IMO having this separate
o1ka 2017/05/02 16:16:01 See my comment in audio_system_impl_unittest.cc. A
alokp 2017/05/09 19:06:15 Done.
14
15 TestAudioThread::~TestAudioThread() {
16 DCHECK(thread_checker_.CalledOnValidThread());
17 }
18
19 void TestAudioThread::Stop() {
20 DCHECK(thread_checker_.CalledOnValidThread());
21 base::RunLoop().RunUntilIdle();
22 task_runner_ = nullptr;
23 }
24
25 base::SingleThreadTaskRunner* TestAudioThread::GetTaskRunner() {
26 return task_runner_.get();
27 }
28
29 base::SingleThreadTaskRunner* TestAudioThread::GetWorkerTaskRunner() {
30 return task_runner_.get();
31 }
32
33 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698