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

Side by Side Diff: net/url_request/url_request.cc

Issue 6292013: Add chunked uploads support to SPDY (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/stats_counters.h" 9 #include "base/metrics/stats_counters.h"
10 #include "base/singleton.h" 10 #include "base/singleton.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 178
179 void URLRequest::EnableChunkedUpload() { 179 void URLRequest::EnableChunkedUpload() {
180 DCHECK(!upload_ || upload_->is_chunked()); 180 DCHECK(!upload_ || upload_->is_chunked());
181 if (!upload_) { 181 if (!upload_) {
182 upload_ = new UploadData(); 182 upload_ = new UploadData();
183 upload_->set_is_chunked(true); 183 upload_->set_is_chunked(true);
184 } 184 }
185 } 185 }
186 186
187 void URLRequest::AppendChunkToUpload(const char* bytes, int bytes_len) { 187 void URLRequest::AppendChunkToUpload(const char* bytes, int bytes_len,
188 bool is_last_chunk) {
188 DCHECK(upload_); 189 DCHECK(upload_);
189 DCHECK(upload_->is_chunked()); 190 DCHECK(upload_->is_chunked());
190 DCHECK_GT(bytes_len, 0); 191 DCHECK_GT(bytes_len, 0);
191 upload_->AppendChunk(bytes, bytes_len); 192 upload_->AppendChunk(bytes, bytes_len, is_last_chunk);
192 }
193
194 void URLRequest::MarkEndOfChunks() {
195 DCHECK(upload_);
196 DCHECK(upload_->is_chunked());
197 upload_->AppendChunk(NULL, 0);
198 } 193 }
199 194
200 void URLRequest::set_upload(net::UploadData* upload) { 195 void URLRequest::set_upload(net::UploadData* upload) {
201 upload_ = upload; 196 upload_ = upload;
202 } 197 }
203 198
204 // Get the upload data directly. 199 // Get the upload data directly.
205 net::UploadData* URLRequest::get_upload() { 200 net::UploadData* URLRequest::get_upload() {
206 return upload_.get(); 201 return upload_.get();
207 } 202 }
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 if (found != user_data_.end()) 640 if (found != user_data_.end())
646 return found->second.get(); 641 return found->second.get();
647 return NULL; 642 return NULL;
648 } 643 }
649 644
650 void URLRequest::SetUserData(const void* key, UserData* data) { 645 void URLRequest::SetUserData(const void* key, UserData* data) {
651 user_data_[key] = linked_ptr<UserData>(data); 646 user_data_[key] = linked_ptr<UserData>(data);
652 } 647 }
653 648
654 } // namespace net 649 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698