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

Side by Side Diff: media/audio/sounds/test_data.cc

Issue 2076423004: Remove calls to MessageLoop::current() in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Created 4 years, 5 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
« no previous file with comments | « media/audio/sounds/test_data.h ('k') | media/base/test_helpers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 8 #include "base/threading/thread_task_runner_handle.h"
9 9
10 namespace media { 10 namespace media {
11 11
12 TestObserver::TestObserver(const base::Closure& quit) 12 TestObserver::TestObserver(const base::Closure& quit)
13 : loop_(base::MessageLoop::current()), 13 : task_runner_(base::ThreadTaskRunnerHandle::Get()),
14 quit_(quit), 14 quit_(quit),
15 num_play_requests_(0), 15 num_play_requests_(0),
16 num_stop_requests_(0), 16 num_stop_requests_(0),
17 cursor_(0) { 17 cursor_(0) {}
18 DCHECK(loop_);
19 }
20 18
21 TestObserver::~TestObserver() { 19 TestObserver::~TestObserver() {
22 } 20 }
23 21
24 void TestObserver::OnPlay() { 22 void TestObserver::OnPlay() {
25 ++num_play_requests_; 23 ++num_play_requests_;
26 } 24 }
27 25
28 void TestObserver::OnStop(size_t cursor) { 26 void TestObserver::OnStop(size_t cursor) {
29 ++num_stop_requests_; 27 ++num_stop_requests_;
30 cursor_ = cursor; 28 cursor_ = cursor;
31 loop_->PostTask(FROM_HERE, quit_); 29 task_runner_->PostTask(FROM_HERE, quit_);
32 } 30 }
33 31
34 } // namespace media 32 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/sounds/test_data.h ('k') | media/base/test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698