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

Side by Side Diff: content/browser/speech/speech_recognition_manager_impl.h

Issue 11149006: Extend scoped_ptr to be closer to unique_ptr. Support custom deleters, and deleting arrays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix reset() to not call deleter on NULL ptr_. Matches unique_ptr<> spec. Created 8 years 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 CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 virtual void OnRecognitionEnd(int session_id) OVERRIDE; 83 virtual void OnRecognitionEnd(int session_id) OVERRIDE;
84 virtual void OnRecognitionResult( 84 virtual void OnRecognitionResult(
85 int session_id, const SpeechRecognitionResult& result) OVERRIDE; 85 int session_id, const SpeechRecognitionResult& result) OVERRIDE;
86 virtual void OnRecognitionError( 86 virtual void OnRecognitionError(
87 int session_id, const SpeechRecognitionError& error) OVERRIDE; 87 int session_id, const SpeechRecognitionError& error) OVERRIDE;
88 virtual void OnAudioLevelsChange(int session_id, float volume, 88 virtual void OnAudioLevelsChange(int session_id, float volume,
89 float noise_volume) OVERRIDE; 89 float noise_volume) OVERRIDE;
90 90
91 protected: 91 protected:
92 // BrowserMainLoop is the only one allowed to istantiate and free us. 92 // BrowserMainLoop is the only one allowed to istantiate and free us.
93 // Needed for dtor.
Jeffrey Yasskin 2012/11/28 06:07:18 This should be 1 line down.
awong 2012/11/28 10:20:35 Done.
93 friend class BrowserMainLoop; 94 friend class BrowserMainLoop;
94 friend class scoped_ptr<SpeechRecognitionManagerImpl>; // Needed for dtor. 95 friend struct base::DefaultDeleter<SpeechRecognitionManagerImpl>;
95 SpeechRecognitionManagerImpl(); 96 SpeechRecognitionManagerImpl();
96 virtual ~SpeechRecognitionManagerImpl(); 97 virtual ~SpeechRecognitionManagerImpl();
97 98
98 private: 99 private:
99 // Data types for the internal Finite State Machine (FSM). 100 // Data types for the internal Finite State Machine (FSM).
100 enum FSMState { 101 enum FSMState {
101 SESSION_STATE_IDLE = 0, 102 SESSION_STATE_IDLE = 0,
102 SESSION_STATE_CAPTURING_AUDIO, 103 SESSION_STATE_CAPTURING_AUDIO,
103 SESSION_STATE_WAITING_FOR_RESULT, 104 SESSION_STATE_WAITING_FOR_RESULT,
104 SESSION_STATE_MAX_VALUE = SESSION_STATE_WAITING_FOR_RESULT 105 SESSION_STATE_MAX_VALUE = SESSION_STATE_WAITING_FOR_RESULT
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 171
171 // Used for posting asynchronous tasks (on the IO thread) without worrying 172 // Used for posting asynchronous tasks (on the IO thread) without worrying
172 // about this class being destroyed in the meanwhile (due to browser shutdown) 173 // about this class being destroyed in the meanwhile (due to browser shutdown)
173 // since tasks pending on a destroyed WeakPtr are automatically discarded. 174 // since tasks pending on a destroyed WeakPtr are automatically discarded.
174 base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_; 175 base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_;
175 }; 176 };
176 177
177 } // namespace content 178 } // namespace content
178 179
179 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ 180 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698