OLD | NEW |
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 Loading... |
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, |
| 188 int bytes_len, |
| 189 bool is_last_chunk) { |
188 DCHECK(upload_); | 190 DCHECK(upload_); |
189 DCHECK(upload_->is_chunked()); | 191 DCHECK(upload_->is_chunked()); |
190 DCHECK_GT(bytes_len, 0); | 192 DCHECK_GT(bytes_len, 0); |
191 upload_->AppendChunk(bytes, bytes_len); | 193 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 } | 194 } |
199 | 195 |
200 void URLRequest::set_upload(net::UploadData* upload) { | 196 void URLRequest::set_upload(net::UploadData* upload) { |
201 upload_ = upload; | 197 upload_ = upload; |
202 } | 198 } |
203 | 199 |
204 // Get the upload data directly. | 200 // Get the upload data directly. |
205 net::UploadData* URLRequest::get_upload() { | 201 net::UploadData* URLRequest::get_upload() { |
206 return upload_.get(); | 202 return upload_.get(); |
207 } | 203 } |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 if (found != user_data_.end()) | 641 if (found != user_data_.end()) |
646 return found->second.get(); | 642 return found->second.get(); |
647 return NULL; | 643 return NULL; |
648 } | 644 } |
649 | 645 |
650 void URLRequest::SetUserData(const void* key, UserData* data) { | 646 void URLRequest::SetUserData(const void* key, UserData* data) { |
651 user_data_[key] = linked_ptr<UserData>(data); | 647 user_data_[key] = linked_ptr<UserData>(data); |
652 } | 648 } |
653 | 649 |
654 } // namespace net | 650 } // namespace net |
OLD | NEW |