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

Unified Diff: net/base/upload_data.cc

Issue 10834289: Split net::UploadData into two: for IPC and for upload handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: net/base/upload_data.cc
diff --git a/net/base/upload_data.cc b/net/base/upload_data.cc
index b13e9091e8cb0051caeb26a516ba1cd806f600d0..87a37ac57d7b003319f7193b5a2e2c9dbafc0069 100644
--- a/net/base/upload_data.cc
+++ b/net/base/upload_data.cc
@@ -31,6 +31,8 @@ void OnGetContentLengthComplete(
UploadData::Element::Element()
: type_(TYPE_BYTES),
+ bytes_start_(NULL),
+ bytes_length_(0),
file_range_offset_(0),
file_range_length_(kuint64max),
is_last_chunk_(false),
@@ -54,9 +56,8 @@ UploadData::Element::~Element() {
void UploadData::Element::SetToChunk(const char* bytes,
int bytes_len,
bool is_last_chunk) {
- bytes_.clear();
- bytes_.insert(bytes_.end(), bytes, bytes + bytes_len);
type_ = TYPE_CHUNK;
+ buf_.assign(bytes, bytes + bytes_len);
is_last_chunk_ = is_last_chunk;
}
@@ -65,10 +66,7 @@ uint64 UploadData::Element::GetContentLength() {
return content_length_;
if (type_ == TYPE_BYTES || type_ == TYPE_CHUNK)
- return static_cast<uint64>(bytes_.size());
- else if (type_ == TYPE_BLOB)
- // The blob reference will be resolved later.
- return 0;
+ return bytes_length();
DCHECK_EQ(TYPE_FILE, type_);
DCHECK(!file_stream_);
@@ -162,9 +160,8 @@ int UploadData::Element::ReadFromMemorySync(char* buf, int buf_len) {
// Check if we have anything to copy first, because we are getting
// the address of an element in |bytes_| and that will throw an
// exception if |bytes_| is an empty vector.
- if (num_bytes_to_read > 0) {
- memcpy(buf, &bytes_[offset_], num_bytes_to_read);
- }
+ if (num_bytes_to_read > 0)
+ memcpy(buf, bytes() + offset_, num_bytes_to_read);
offset_ += num_bytes_to_read;
return num_bytes_to_read;
@@ -230,12 +227,6 @@ void UploadData::AppendFileRange(const FilePath& file_path,
expected_modification_time);
}
-void UploadData::AppendBlob(const GURL& blob_url) {
- DCHECK(!is_chunked_);
- elements_.push_back(Element());
- elements_.back().SetToBlobUrl(blob_url);
-}
-
void UploadData::AppendChunk(const char* bytes,
int bytes_len,
bool is_last_chunk) {

Powered by Google App Engine
This is Rietveld 408576698