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

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

Issue 9255017: Add thread safety to AudioManagerBase to protect access to the audio thread member variable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style issue Created 8 years, 11 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 | Annotate | Revision Log
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 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_
6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ 6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "media/audio/audio_device_name.h" 13 #include "media/audio/audio_device_name.h"
14 #include "media/audio/audio_parameters.h" 14 #include "media/audio/audio_parameters.h"
15 15
16 class AudioInputStream; 16 class AudioInputStream;
17 class AudioOutputStream; 17 class AudioOutputStream;
18 class MessageLoop; 18 class MessageLoop;
19 namespace base {
20 class MessageLoopProxy;
21 }
19 22
20 // Manages all audio resources. In particular it owns the AudioOutputStream 23 // Manages all audio resources. In particular it owns the AudioOutputStream
21 // objects. Provides some convenience functions that avoid the need to provide 24 // objects. Provides some convenience functions that avoid the need to provide
22 // iterators over the existing streams. 25 // iterators over the existing streams.
23 // TODO(tommi): Make the manager non-refcounted when it's safe to do so. 26 // TODO(tommi): Make the manager non-refcounted when it's safe to do so.
24 // -> Bug 107087. 27 // -> Bug 107087.
25 class MEDIA_EXPORT AudioManager 28 class MEDIA_EXPORT AudioManager
26 : public base::RefCountedThreadSafe<AudioManager> { 29 : public base::RefCountedThreadSafe<AudioManager> {
27 public: 30 public:
28 AudioManager(); 31 AudioManager();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 117
115 // Muting continues playback but effectively the volume is set to zero. 118 // Muting continues playback but effectively the volume is set to zero.
116 // Un-muting returns the volume to the previous level. 119 // Un-muting returns the volume to the previous level.
117 virtual void MuteAll() = 0; 120 virtual void MuteAll() = 0;
118 virtual void UnMuteAll() = 0; 121 virtual void UnMuteAll() = 0;
119 122
120 // Used to determine if something else is currently making use of audio input. 123 // Used to determine if something else is currently making use of audio input.
121 virtual bool IsRecordingInProcess() = 0; 124 virtual bool IsRecordingInProcess() = 0;
122 125
123 // Returns message loop used for audio IO. 126 // Returns message loop used for audio IO.
124 virtual MessageLoop* GetMessageLoop() = 0; 127 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() = 0;
125 128
126 protected: 129 protected:
127 // Called from Create() to initialize the instance. 130 // Called from Create() to initialize the instance.
128 virtual void Init() = 0; 131 virtual void Init() = 0;
129 132
130 friend class base::RefCountedThreadSafe<AudioManager>; 133 friend class base::RefCountedThreadSafe<AudioManager>;
131 virtual ~AudioManager(); 134 virtual ~AudioManager();
132 }; 135 };
133 136
134 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ 137 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_low_latency_input_output_unittest.cc ('k') | media/audio/audio_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698