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

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

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 #ifndef CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_
6 #define CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_ 6 #define CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
18 #include "content/browser/speech/audio_encoder.h" 18 #include "content/browser/speech/audio_encoder.h"
19 #include "content/browser/speech/chunked_byte_buffer.h" 19 #include "content/browser/speech/chunked_byte_buffer.h"
20 #include "content/browser/speech/speech_recognition_engine.h" 20 #include "content/browser/speech/speech_recognition_engine.h"
21 #include "content/common/content_export.h" 21 #include "content/common/content_export.h"
22 #include "content/public/common/speech_recognition_error.h" 22 #include "content/public/common/speech_recognition_error.h"
23 #include "net/url_request/url_fetcher_delegate.h" 23 #include "net/url_request/url_fetcher_delegate.h"
24 24
25 namespace net { 25 namespace net {
26 class URLRequestContextGetter; 26 class URLRequestContextGetter;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 struct FSMEventArgs { 112 struct FSMEventArgs {
113 explicit FSMEventArgs(FSMEvent event_value); 113 explicit FSMEventArgs(FSMEvent event_value);
114 ~FSMEventArgs(); 114 ~FSMEventArgs();
115 115
116 FSMEvent event; 116 FSMEvent event;
117 117
118 // In case of EVENT_AUDIO_CHUNK, holds the chunk pushed by |TakeAudioChunk|. 118 // In case of EVENT_AUDIO_CHUNK, holds the chunk pushed by |TakeAudioChunk|.
119 scoped_refptr<const AudioChunk> audio_data; 119 scoped_refptr<const AudioChunk> audio_data;
120 120
121 // In case of EVENT_DOWNSTREAM_RESPONSE, hold the current chunk bytes. 121 // In case of EVENT_DOWNSTREAM_RESPONSE, hold the current chunk bytes.
122 scoped_ptr<std::vector<uint8_t>> response; 122 std::unique_ptr<std::vector<uint8_t>> response;
123 123
124 private: 124 private:
125 DISALLOW_COPY_AND_ASSIGN(FSMEventArgs); 125 DISALLOW_COPY_AND_ASSIGN(FSMEventArgs);
126 }; 126 };
127 127
128 // Invoked by both upstream and downstream URLFetcher callbacks to handle 128 // Invoked by both upstream and downstream URLFetcher callbacks to handle
129 // new chunk data, connection closed or errors notifications. 129 // new chunk data, connection closed or errors notifications.
130 void DispatchHTTPResponse(const net::URLFetcher* source, 130 void DispatchHTTPResponse(const net::URLFetcher* source,
131 bool end_of_response); 131 bool end_of_response);
132 132
(...skipping 18 matching lines...) Expand all
151 FSMState NotFeasible(const FSMEventArgs& event_args); 151 FSMState NotFeasible(const FSMEventArgs& event_args);
152 152
153 std::string GetAcceptedLanguages() const; 153 std::string GetAcceptedLanguages() const;
154 std::string GenerateRequestKey() const; 154 std::string GenerateRequestKey() const;
155 155
156 // Upload a single chunk of audio data. Handles both unframed and framed 156 // Upload a single chunk of audio data. Handles both unframed and framed
157 // upload formats, and uses the appropriate one. 157 // upload formats, and uses the appropriate one.
158 void UploadAudioChunk(const std::string& data, FrameType type, bool is_final); 158 void UploadAudioChunk(const std::string& data, FrameType type, bool is_final);
159 159
160 SpeechRecognitionEngineConfig config_; 160 SpeechRecognitionEngineConfig config_;
161 scoped_ptr<net::URLFetcher> upstream_fetcher_; 161 std::unique_ptr<net::URLFetcher> upstream_fetcher_;
162 scoped_ptr<net::URLFetcher> downstream_fetcher_; 162 std::unique_ptr<net::URLFetcher> downstream_fetcher_;
163 scoped_refptr<net::URLRequestContextGetter> url_context_; 163 scoped_refptr<net::URLRequestContextGetter> url_context_;
164 scoped_ptr<AudioEncoder> encoder_; 164 std::unique_ptr<AudioEncoder> encoder_;
165 scoped_ptr<AudioEncoder> preamble_encoder_; 165 std::unique_ptr<AudioEncoder> preamble_encoder_;
166 ChunkedByteBuffer chunked_byte_buffer_; 166 ChunkedByteBuffer chunked_byte_buffer_;
167 size_t previous_response_length_; 167 size_t previous_response_length_;
168 bool got_last_definitive_result_; 168 bool got_last_definitive_result_;
169 bool is_dispatching_event_; 169 bool is_dispatching_event_;
170 bool use_framed_post_data_; 170 bool use_framed_post_data_;
171 FSMState state_; 171 FSMState state_;
172 172
173 DISALLOW_COPY_AND_ASSIGN(GoogleStreamingRemoteEngine); 173 DISALLOW_COPY_AND_ASSIGN(GoogleStreamingRemoteEngine);
174 }; 174 };
175 175
176 } // namespace content 176 } // namespace content
177 177
178 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_ 178 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698