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

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

Issue 921453003: Allow URLRequest::AppendChunkToUpload to take 0-byte final chunks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reduce tests, refactor out some of the boilerplate, merge some lines Created 5 years, 10 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
« no previous file with comments | « net/url_request/url_request.h ('k') | no next file » | 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 #include "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 upload_chunked_data_stream_ = new ChunkedUploadDataStream(0); 203 upload_chunked_data_stream_ = new ChunkedUploadDataStream(0);
204 upload_data_stream_.reset(upload_chunked_data_stream_); 204 upload_data_stream_.reset(upload_chunked_data_stream_);
205 } 205 }
206 } 206 }
207 207
208 void URLRequest::AppendChunkToUpload(const char* bytes, 208 void URLRequest::AppendChunkToUpload(const char* bytes,
209 int bytes_len, 209 int bytes_len,
210 bool is_last_chunk) { 210 bool is_last_chunk) {
211 DCHECK(upload_data_stream_); 211 DCHECK(upload_data_stream_);
212 DCHECK(upload_data_stream_->is_chunked()); 212 DCHECK(upload_data_stream_->is_chunked());
213 DCHECK_GT(bytes_len, 0);
214 upload_chunked_data_stream_->AppendData(bytes, bytes_len, is_last_chunk); 213 upload_chunked_data_stream_->AppendData(bytes, bytes_len, is_last_chunk);
215 } 214 }
216 215
217 void URLRequest::set_upload(scoped_ptr<UploadDataStream> upload) { 216 void URLRequest::set_upload(scoped_ptr<UploadDataStream> upload) {
218 DCHECK(!upload->is_chunked()); 217 DCHECK(!upload->is_chunked());
219 upload_data_stream_ = upload.Pass(); 218 upload_data_stream_ = upload.Pass();
220 } 219 }
221 220
222 const UploadDataStream* URLRequest::get_upload() const { 221 const UploadDataStream* URLRequest::get_upload() const {
223 return upload_data_stream_.get(); 222 return upload_data_stream_.get();
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 new base::debug::StackTrace(NULL, 0); 1197 new base::debug::StackTrace(NULL, 0);
1199 *stack_trace_copy = stack_trace; 1198 *stack_trace_copy = stack_trace;
1200 stack_trace_.reset(stack_trace_copy); 1199 stack_trace_.reset(stack_trace_copy);
1201 } 1200 }
1202 1201
1203 const base::debug::StackTrace* URLRequest::stack_trace() const { 1202 const base::debug::StackTrace* URLRequest::stack_trace() const {
1204 return stack_trace_.get(); 1203 return stack_trace_.get();
1205 } 1204 }
1206 1205
1207 } // namespace net 1206 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698