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

Side by Side Diff: media/audio/mac/audio_manager_mac.cc

Issue 655713003: Standardize usage of virtual/override/final in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/mac/audio_manager_mac.h ('k') | media/audio/mock_audio_manager.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 (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/mac/audio_manager_mac.h" 5 #include "media/audio/mac/audio_manager_mac.h"
6 6
7 #include <CoreAudio/AudioHardware.h> 7 #include <CoreAudio/AudioHardware.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 : is_suspending_(false), 229 : is_suspending_(false),
230 is_monitoring_(base::PowerMonitor::Get()) { 230 is_monitoring_(base::PowerMonitor::Get()) {
231 // The PowerMonitor requires signifcant setup (a CFRunLoop and preallocated 231 // The PowerMonitor requires signifcant setup (a CFRunLoop and preallocated
232 // IO ports) so it's not available under unit tests. See the OSX impl of 232 // IO ports) so it's not available under unit tests. See the OSX impl of
233 // base::PowerMonitorDeviceSource for more details. 233 // base::PowerMonitorDeviceSource for more details.
234 if (!is_monitoring_) 234 if (!is_monitoring_)
235 return; 235 return;
236 base::PowerMonitor::Get()->AddObserver(this); 236 base::PowerMonitor::Get()->AddObserver(this);
237 } 237 }
238 238
239 virtual ~AudioPowerObserver() { 239 ~AudioPowerObserver() override {
240 DCHECK(thread_checker_.CalledOnValidThread()); 240 DCHECK(thread_checker_.CalledOnValidThread());
241 if (!is_monitoring_) 241 if (!is_monitoring_)
242 return; 242 return;
243 base::PowerMonitor::Get()->RemoveObserver(this); 243 base::PowerMonitor::Get()->RemoveObserver(this);
244 } 244 }
245 245
246 bool ShouldDeferStreamStart() { 246 bool ShouldDeferStreamStart() {
247 DCHECK(thread_checker_.CalledOnValidThread()); 247 DCHECK(thread_checker_.CalledOnValidThread());
248 // Start() should be deferred if the system is in the middle of a suspend or 248 // Start() should be deferred if the system is in the middle of a suspend or
249 // has recently started the process of resuming. 249 // has recently started the process of resuming.
250 return is_suspending_ || base::TimeTicks::Now() < earliest_start_time_; 250 return is_suspending_ || base::TimeTicks::Now() < earliest_start_time_;
251 } 251 }
252 252
253 private: 253 private:
254 virtual void OnSuspend() override { 254 void OnSuspend() override {
255 DCHECK(thread_checker_.CalledOnValidThread()); 255 DCHECK(thread_checker_.CalledOnValidThread());
256 is_suspending_ = true; 256 is_suspending_ = true;
257 } 257 }
258 258
259 virtual void OnResume() override { 259 void OnResume() override {
260 DCHECK(thread_checker_.CalledOnValidThread()); 260 DCHECK(thread_checker_.CalledOnValidThread());
261 is_suspending_ = false; 261 is_suspending_ = false;
262 earliest_start_time_ = base::TimeTicks::Now() + 262 earliest_start_time_ = base::TimeTicks::Now() +
263 base::TimeDelta::FromSeconds(kStartDelayInSecsForPowerEvents); 263 base::TimeDelta::FromSeconds(kStartDelayInSecsForPowerEvents);
264 } 264 }
265 265
266 bool is_suspending_; 266 bool is_suspending_;
267 const bool is_monitoring_; 267 const bool is_monitoring_;
268 base::TimeTicks earliest_start_time_; 268 base::TimeTicks earliest_start_time_;
269 base::ThreadChecker thread_checker_; 269 base::ThreadChecker thread_checker_;
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) { 747 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) {
748 input_streams_.remove(stream); 748 input_streams_.remove(stream);
749 AudioManagerBase::ReleaseInputStream(stream); 749 AudioManagerBase::ReleaseInputStream(stream);
750 } 750 }
751 751
752 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { 752 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) {
753 return new AudioManagerMac(audio_log_factory); 753 return new AudioManagerMac(audio_log_factory);
754 } 754 }
755 755
756 } // namespace media 756 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/mac/audio_manager_mac.h ('k') | media/audio/mock_audio_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698