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

Side by Side Diff: media/audio/audio_system.h

Issue 2869733005: Convert some audio code to OnceCallback. (Closed)
Patch Set: Rebase, comments on unretained. Created 3 years, 7 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/audio_output_controller_unittest.cc ('k') | media/audio/audio_system_impl.cc » ('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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef MEDIA_AUDIO_AUDIO_SYSTEM_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_SYSTEM_H_
6 #define MEDIA_AUDIO_AUDIO_SYSTEM_H_ 6 #define MEDIA_AUDIO_AUDIO_SYSTEM_H_
7 7
8 #include <string>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "media/audio/audio_device_description.h" 11 #include "media/audio/audio_device_description.h"
10 #include "media/base/audio_parameters.h" 12 #include "media/base/audio_parameters.h"
11 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
12 14
13 namespace base { 15 namespace base {
14 class SingleThreadTaskRunner; 16 class SingleThreadTaskRunner;
15 } 17 }
16 18
17 namespace media { 19 namespace media {
18 class AudioManager; 20 class AudioManager;
19 21
20 // Work in progress: Provides asynchronous interface to AudioManager. All the 22 // Work in progress: Provides asynchronous interface to AudioManager. All the
21 // AudioManager clients will be switched to it, in preparation for moving 23 // AudioManager clients will be switched to it, in preparation for moving
22 // to Mojo audio service. 24 // to Mojo audio service.
23 class MEDIA_EXPORT AudioSystem { 25 class MEDIA_EXPORT AudioSystem {
24 public: 26 public:
25 // Replies are asynchronously sent from audio system thread to the thread the 27 // Replies are asynchronously sent from audio system thread to the thread the
26 // call is issued on. Attention! Audio system thread may outlive the client 28 // call is issued on. Attention! Audio system thread may outlive the client
27 // objects; bind callbacks with care. 29 // objects; bind callbacks with care.
28 using OnAudioParamsCallback = base::Callback<void(const AudioParameters&)>; 30 using OnAudioParamsCallback =
29 using OnBoolCallback = base::Callback<void(bool)>; 31 base::OnceCallback<void(const AudioParameters&)>;
32 using OnBoolCallback = base::OnceCallback<void(bool)>;
30 using OnDeviceDescriptionsCallback = 33 using OnDeviceDescriptionsCallback =
31 base::Callback<void(AudioDeviceDescriptions)>; 34 base::OnceCallback<void(AudioDeviceDescriptions)>;
32 using OnDeviceIdCallback = base::Callback<void(const std::string&)>; 35 using OnDeviceIdCallback = base::OnceCallback<void(const std::string&)>;
33 using OnInputDeviceInfoCallback = base::Callback< 36 using OnInputDeviceInfoCallback = base::OnceCallback<
34 void(const AudioParameters&, const AudioParameters&, const std::string&)>; 37 void(const AudioParameters&, const AudioParameters&, const std::string&)>;
35 38
36 // Must not be called on audio system thread if it differs from the one 39 // Must not be called on audio system thread if it differs from the one
37 // AudioSystem is destroyed on. See http://crbug.com/705455. 40 // AudioSystem is destroyed on. See http://crbug.com/705455.
38 static AudioSystem* Get(); 41 static AudioSystem* Get();
39 42
40 virtual ~AudioSystem(); 43 virtual ~AudioSystem();
41 44
42 // Callback may receive invalid parameters, it means the specified device is 45 // Callback may receive invalid parameters, it means the specified device is
43 // not found. This is best-effort: valid parameters do not guarantee existance 46 // not found. This is best-effort: valid parameters do not guarantee existance
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Sets the global AudioSystem pointer to the specified non-null value. 90 // Sets the global AudioSystem pointer to the specified non-null value.
88 static void SetInstance(AudioSystem* audio_system); 91 static void SetInstance(AudioSystem* audio_system);
89 92
90 // Sets the global AudioSystem pointer to null if it equals the specified one. 93 // Sets the global AudioSystem pointer to null if it equals the specified one.
91 static void ClearInstance(const AudioSystem* audio_system); 94 static void ClearInstance(const AudioSystem* audio_system);
92 }; 95 };
93 96
94 } // namespace media 97 } // namespace media
95 98
96 #endif // MEDIA_AUDIO_AUDIO_SYSTEM_H_ 99 #endif // MEDIA_AUDIO_AUDIO_SYSTEM_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_controller_unittest.cc ('k') | media/audio/audio_system_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698