OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/audio/sounds/test_data.h" | 5 #include "media/audio/sounds/test_data.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | |
9 | 8 |
10 namespace media { | 9 namespace media { |
11 | 10 |
12 TestObserver::TestObserver(const base::Closure& quit) | 11 TestObserver::TestObserver(const base::Closure& quit) |
13 : loop_(base::MessageLoop::current()), | 12 : task_runner_(base::ThreadTaskRunnerHandle::Get()), |
14 quit_(quit), | 13 quit_(quit), |
15 num_play_requests_(0), | 14 num_play_requests_(0), |
16 num_stop_requests_(0), | 15 num_stop_requests_(0), |
17 cursor_(0) { | 16 cursor_(0) { |
18 DCHECK(loop_); | 17 DCHECK(loop_); |
chcunningham
2016/06/21 21:29:59
Delete this one.
fdoray
2016/06/29 15:44:31
Done.
| |
19 } | 18 } |
20 | 19 |
21 TestObserver::~TestObserver() { | 20 TestObserver::~TestObserver() { |
22 } | 21 } |
23 | 22 |
24 void TestObserver::OnPlay() { | 23 void TestObserver::OnPlay() { |
25 ++num_play_requests_; | 24 ++num_play_requests_; |
26 } | 25 } |
27 | 26 |
28 void TestObserver::OnStop(size_t cursor) { | 27 void TestObserver::OnStop(size_t cursor) { |
29 ++num_stop_requests_; | 28 ++num_stop_requests_; |
30 cursor_ = cursor; | 29 cursor_ = cursor; |
31 loop_->PostTask(FROM_HERE, quit_); | 30 task_runner_->PostTask(FROM_HERE, quit_); |
32 } | 31 } |
33 | 32 |
34 } // namespace media | 33 } // namespace media |
OLD | NEW |