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

Unified Diff: net/url_request/url_request.cc

Issue 11439008: net: Change argument of URLRequest::set_upload from UploadData to UploadDataStream (Closed) Base URL: http://git.chromium.org/chromium/src.git@chunk
Patch Set: Fix android Created 8 years 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
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request.cc
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 8831ec69a1f960aff491c478e1625cc18de571f8..735a34de1ad869a55bb983db1651acbf3c3c48dc 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -23,10 +23,7 @@
#include "net/base/network_change_notifier.h"
#include "net/base/network_delegate.h"
#include "net/base/ssl_cert_request_info.h"
-#include "net/base/upload_bytes_element_reader.h"
-#include "net/base/upload_data.h"
#include "net/base/upload_data_stream.h"
-#include "net/base/upload_file_element_reader.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "net/url_request/url_request_context.h"
@@ -273,33 +270,9 @@ void URLRequest::AppendChunkToUpload(const char* bytes,
upload_data_stream_->AppendChunk(bytes, bytes_len, is_last_chunk);
}
-void URLRequest::set_upload(UploadData* upload) {
+void URLRequest::set_upload(scoped_ptr<UploadDataStream> upload) {
DCHECK(!upload->is_chunked());
- upload_ = upload;
- ScopedVector<UploadElementReader> element_readers;
- const ScopedVector<UploadElement>& elements = upload->elements();
- for (ScopedVector<UploadElement>::const_iterator it = elements.begin();
- it != elements.end(); ++it) {
- UploadElementReader* reader = NULL;
- const UploadElement& element = **it;
- switch (element.type()) {
- case UploadElement::TYPE_BYTES:
- reader = new UploadBytesElementReader(element.bytes(),
- element.bytes_length());
- break;
- case UploadElement::TYPE_FILE:
- reader = new UploadFileElementReader(
- element.file_path(),
- element.file_range_offset(),
- element.file_range_length(),
- element.expected_file_modification_time());
- break;
- }
- DCHECK(reader);
- element_readers.push_back(reader);
- }
- upload_data_stream_.reset(new UploadDataStream(&element_readers,
- upload->identifier()));
+ upload_data_stream_ = upload.Pass();
}
const UploadDataStream* URLRequest::get_upload() const {
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698