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

Unified Diff: chrome/browser/speech/speech_recognition_request.cc

Issue 6134003: Prototype of chunked transfer encoded POST. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/speech/speech_recognition_request.cc
diff --git a/chrome/browser/speech/speech_recognition_request.cc b/chrome/browser/speech/speech_recognition_request.cc
index 402af7ed98280a547dbfaf552d693f6a077f8eb7..3398d532900f85c0f907818340d8a9bef4c07d96 100644
--- a/chrome/browser/speech/speech_recognition_request.cc
+++ b/chrome/browser/speech/speech_recognition_request.cc
@@ -120,11 +120,10 @@ SpeechRecognitionRequest::SpeechRecognitionRequest(
SpeechRecognitionRequest::~SpeechRecognitionRequest() {}
-bool SpeechRecognitionRequest::Send(const std::string& language,
- const std::string& grammar,
- const std::string& hardware_info,
- const std::string& content_type,
- const std::string& audio_data) {
+void SpeechRecognitionRequest::Start(const std::string& language,
+ const std::string& grammar,
+ const std::string& hardware_info,
+ const std::string& content_type) {
DCHECK(!url_fetcher_.get());
std::vector<std::string> parts;
@@ -158,7 +157,7 @@ bool SpeechRecognitionRequest::Send(const std::string& language,
url,
URLFetcher::POST,
this));
- url_fetcher_->set_upload_data(content_type, audio_data);
+ url_fetcher_->set_chunked_upload(content_type);
url_fetcher_->set_request_context(url_context_);
// The speech recognition API does not require user identification as part
@@ -169,7 +168,16 @@ bool SpeechRecognitionRequest::Send(const std::string& language,
net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES |
net::LOAD_DO_NOT_SEND_AUTH_DATA);
url_fetcher_->Start();
- return true;
+}
+
+void SpeechRecognitionRequest::UploadAudioChunk(const std::string& audio_data) {
+ DCHECK(url_fetcher_.get());
+ url_fetcher_->AppendChunkToUpload(audio_data);
+}
+
+void SpeechRecognitionRequest::FinishAudioUpload() {
+ DCHECK(url_fetcher_.get());
+ url_fetcher_->MarkEndOfChunks();
}
void SpeechRecognitionRequest::OnURLFetchComplete(

Powered by Google App Engine
This is Rietveld 408576698