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

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

Issue 10067035: RefCounted types should not have public destructors, media/ and gpu/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 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 | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/service/query_manager.cc ('k') | media/audio/audio_output_dispatcher.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 #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // to create the AudioInputController. Factory is intended for testing only. 110 // to create the AudioInputController. Factory is intended for testing only.
111 class Factory { 111 class Factory {
112 public: 112 public:
113 virtual AudioInputController* Create(AudioManager* audio_manager, 113 virtual AudioInputController* Create(AudioManager* audio_manager,
114 EventHandler* event_handler, 114 EventHandler* event_handler,
115 AudioParameters params) = 0; 115 AudioParameters params) = 0;
116 protected: 116 protected:
117 virtual ~Factory() {} 117 virtual ~Factory() {}
118 }; 118 };
119 119
120 virtual ~AudioInputController();
121
122 // Factory method for creating an AudioInputController. 120 // Factory method for creating an AudioInputController.
123 // The audio device will be created on the audio thread, and when that is 121 // The audio device will be created on the audio thread, and when that is
124 // done, the event handler will receive an OnCreated() call from that same 122 // done, the event handler will receive an OnCreated() call from that same
125 // thread. 123 // thread.
126 static scoped_refptr<AudioInputController> Create( 124 static scoped_refptr<AudioInputController> Create(
127 AudioManager* audio_manager, 125 AudioManager* audio_manager,
128 EventHandler* event_handler, 126 EventHandler* event_handler,
129 const AudioParameters& params); 127 const AudioParameters& params);
130 128
131 // Sets the factory used by the static method Create(). AudioInputController 129 // Sets the factory used by the static method Create(). AudioInputController
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 uint32 hardware_delay_bytes, double volume) OVERRIDE; 172 uint32 hardware_delay_bytes, double volume) OVERRIDE;
175 virtual void OnClose(AudioInputStream* stream) OVERRIDE; 173 virtual void OnClose(AudioInputStream* stream) OVERRIDE;
176 virtual void OnError(AudioInputStream* stream, int code) OVERRIDE; 174 virtual void OnError(AudioInputStream* stream, int code) OVERRIDE;
177 175
178 bool LowLatencyMode() const { return sync_writer_ != NULL; } 176 bool LowLatencyMode() const { return sync_writer_ != NULL; }
179 scoped_refptr<base::MessageLoopProxy> message_loop() const { 177 scoped_refptr<base::MessageLoopProxy> message_loop() const {
180 return message_loop_; 178 return message_loop_;
181 } 179 }
182 180
183 protected: 181 protected:
182 friend class base::RefCountedThreadSafe<AudioInputController>;
183
184 // Internal state of the source. 184 // Internal state of the source.
185 enum State { 185 enum State {
186 kEmpty, 186 kEmpty,
187 kCreated, 187 kCreated,
188 kRecording, 188 kRecording,
189 kClosed, 189 kClosed,
190 kError 190 kError
191 }; 191 };
192 192
193 AudioInputController(EventHandler* handler, SyncWriter* sync_writer); 193 AudioInputController(EventHandler* handler, SyncWriter* sync_writer);
194 virtual ~AudioInputController();
194 195
195 // Methods called on the audio thread (owned by the AudioManager). 196 // Methods called on the audio thread (owned by the AudioManager).
196 void DoCreate(AudioManager* audio_manager, const AudioParameters& params, 197 void DoCreate(AudioManager* audio_manager, const AudioParameters& params,
197 const std::string& device_id); 198 const std::string& device_id);
198 void DoRecord(); 199 void DoRecord();
199 void DoClose(); 200 void DoClose();
200 void DoReportError(int code); 201 void DoReportError(int code);
201 void DoSetVolume(double volume); 202 void DoSetVolume(double volume);
202 void DoSetAutomaticGainControl(bool enabled); 203 void DoSetAutomaticGainControl(bool enabled);
203 204
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 static Factory* factory_; 252 static Factory* factory_;
252 253
253 double max_volume_; 254 double max_volume_;
254 255
255 DISALLOW_COPY_AND_ASSIGN(AudioInputController); 256 DISALLOW_COPY_AND_ASSIGN(AudioInputController);
256 }; 257 };
257 258
258 } // namespace media 259 } // namespace media
259 260
260 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 261 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/query_manager.cc ('k') | media/audio/audio_output_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698