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

Unified Diff: net/base/upload_bytes_element_reader.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/base/upload_bytes_element_reader.h ('k') | net/base/upload_data_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/upload_bytes_element_reader.cc
diff --git a/net/base/upload_bytes_element_reader.cc b/net/base/upload_bytes_element_reader.cc
index eb4c8458960786273888472641c826c233bf82e3..c01a2310502def287d1e941ddfbca8b43af5444a 100644
--- a/net/base/upload_bytes_element_reader.cc
+++ b/net/base/upload_bytes_element_reader.cc
@@ -5,13 +5,14 @@
#include "net/base/upload_bytes_element_reader.h"
#include "base/logging.h"
+#include "base/stl_util.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
namespace net {
UploadBytesElementReader::UploadBytesElementReader(const char* bytes,
- int length)
+ uint64 length)
: bytes_(bytes),
length_(length),
offset_(0) {
@@ -69,4 +70,19 @@ int UploadBytesElementReader::ReadSync(IOBuffer* buf, int buf_length) {
return num_bytes_to_read;
}
+
+UploadOwnedBytesElementReader::UploadOwnedBytesElementReader(
+ std::vector<char>* data)
+ : UploadBytesElementReader(vector_as_array(data), data->size()) {
+ data_.swap(*data);
+}
+
+UploadOwnedBytesElementReader::~UploadOwnedBytesElementReader() {}
+
+UploadOwnedBytesElementReader*
+UploadOwnedBytesElementReader::CreateWithString(const std::string& string) {
+ std::vector<char> data(string.begin(), string.end());
+ return new UploadOwnedBytesElementReader(&data);
+}
+
} // namespace net
« no previous file with comments | « net/base/upload_bytes_element_reader.h ('k') | net/base/upload_data_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698