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

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

Issue 2929823002: Making AudioManagerBase::ShutdownOnAudioThread() platform-agnostic (Closed)
Patch Set: Created 3 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/mac/audio_manager_mac.h" 5 #include "media/audio/mac/audio_manager_mac.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 // Task must be posted last to avoid races from handing out "this" to the 520 // Task must be posted last to avoid races from handing out "this" to the
521 // audio thread. Always PostTask even if we're on the right thread since 521 // audio thread. Always PostTask even if we're on the right thread since
522 // AudioManager creation is on the startup path and this may be slow. 522 // AudioManager creation is on the startup path and this may be slow.
523 GetTaskRunner()->PostTask( 523 GetTaskRunner()->PostTask(
524 FROM_HERE, base::Bind(&AudioManagerMac::InitializeOnAudioThread, 524 FROM_HERE, base::Bind(&AudioManagerMac::InitializeOnAudioThread,
525 base::Unretained(this))); 525 base::Unretained(this)));
526 } 526 }
527 527
528 AudioManagerMac::~AudioManagerMac() = default; 528 AudioManagerMac::~AudioManagerMac() = default;
529 529
530 void AudioManagerMac::ShutdownOnAudioThread() { 530 void AudioManagerMac::ShutdownOnAudioThread(bool immediately) {
531 // We are now in shutdown mode. This flag disables MaybeChangeBufferSize() 531 // We are now in shutdown mode. This flag disables MaybeChangeBufferSize()
532 // and IncreaseIOBufferSizeIfPossible() which both touches native Core Audio 532 // and IncreaseIOBufferSizeIfPossible() which both touches native Core Audio
533 // APIs and they can fail and disrupt tests during shutdown. 533 // APIs and they can fail and disrupt tests during shutdown.
534 in_shutdown_ = true; 534 in_shutdown_ = true;
535 AudioManagerBase::ShutdownOnAudioThread(); 535 AudioManagerBase::ShutdownOnAudioThread(immediately);
536 } 536 }
537 537
538 bool AudioManagerMac::HasAudioOutputDevices() { 538 bool AudioManagerMac::HasAudioOutputDevices() {
539 return HasAudioHardware(kAudioHardwarePropertyDefaultOutputDevice); 539 return HasAudioHardware(kAudioHardwarePropertyDefaultOutputDevice);
540 } 540 }
541 541
542 bool AudioManagerMac::HasAudioInputDevices() { 542 bool AudioManagerMac::HasAudioInputDevices() {
543 return HasAudioHardware(kAudioHardwarePropertyDefaultInputDevice); 543 return HasAudioHardware(kAudioHardwarePropertyDefaultInputDevice);
544 } 544 }
545 545
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 } 1183 }
1184 1184
1185 std::unique_ptr<AudioManager> CreateAudioManager( 1185 std::unique_ptr<AudioManager> CreateAudioManager(
1186 std::unique_ptr<AudioThread> audio_thread, 1186 std::unique_ptr<AudioThread> audio_thread,
1187 AudioLogFactory* audio_log_factory) { 1187 AudioLogFactory* audio_log_factory) {
1188 return base::MakeUnique<AudioManagerMac>(std::move(audio_thread), 1188 return base::MakeUnique<AudioManagerMac>(std::move(audio_thread),
1189 audio_log_factory); 1189 audio_log_factory);
1190 } 1190 }
1191 1191
1192 } // namespace media 1192 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698