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

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

Issue 2076423004: Remove calls to MessageLoop::current() in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 (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 "media/audio/audio_output_device.h" 5 #include "media/audio/audio_output_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <cmath> 10 #include <cmath>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/callback_helpers.h" 13 #include "base/callback_helpers.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
16 #include "base/threading/thread_restrictions.h" 16 #include "base/threading/thread_restrictions.h"
17 #include "base/threading/thread_task_runner_handle.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
19 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 #include "media/audio/audio_device_description.h" 22 #include "media/audio/audio_device_description.h"
22 #include "media/audio/audio_output_controller.h" 23 #include "media/audio/audio_output_controller.h"
23 #include "media/base/limits.h" 24 #include "media/base/limits.h"
24 25
25 namespace media { 26 namespace media {
26 27
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void AudioOutputDevice::Start() { 112 void AudioOutputDevice::Start() {
112 DCHECK(callback_) << "Initialize hasn't been called"; 113 DCHECK(callback_) << "Initialize hasn't been called";
113 task_runner()->PostTask(FROM_HERE, 114 task_runner()->PostTask(FROM_HERE,
114 base::Bind(&AudioOutputDevice::CreateStreamOnIOThread, this, 115 base::Bind(&AudioOutputDevice::CreateStreamOnIOThread, this,
115 audio_parameters_)); 116 audio_parameters_));
116 } 117 }
117 118
118 void AudioOutputDevice::Stop() { 119 void AudioOutputDevice::Stop() {
119 { 120 {
120 base::AutoLock auto_lock(audio_thread_lock_); 121 base::AutoLock auto_lock(audio_thread_lock_);
121 audio_thread_.Stop(base::MessageLoop::current()); 122 audio_thread_.Stop(base::ThreadTaskRunnerHandle::Get());
122 stopping_hack_ = true; 123 stopping_hack_ = true;
123 } 124 }
124 125
125 task_runner()->PostTask(FROM_HERE, 126 task_runner()->PostTask(FROM_HERE,
126 base::Bind(&AudioOutputDevice::ShutDownOnIOThread, this)); 127 base::Bind(&AudioOutputDevice::ShutDownOnIOThread, this));
127 } 128 }
128 129
129 void AudioOutputDevice::Play() { 130 void AudioOutputDevice::Play() {
130 task_runner()->PostTask(FROM_HERE, 131 task_runner()->PostTask(FROM_HERE,
131 base::Bind(&AudioOutputDevice::PlayOnIOThread, this)); 132 base::Bind(&AudioOutputDevice::PlayOnIOThread, this));
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), 488 render_callback_->Render(output_bus_.get(), std::round(frames_delayed),
488 frames_skipped); 489 frames_skipped);
489 } 490 }
490 491
491 bool AudioOutputDevice::AudioThreadCallback:: 492 bool AudioOutputDevice::AudioThreadCallback::
492 CurrentThreadIsAudioDeviceThread() { 493 CurrentThreadIsAudioDeviceThread() {
493 return thread_checker_.CalledOnValidThread(); 494 return thread_checker_.CalledOnValidThread();
494 } 495 }
495 496
496 } // namespace media 497 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698