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

Unified Diff: net/base/upload_element.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: rebase + moved ResolveBlobRef from webkit_blob to webkit_glue 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
« no previous file with comments | « net/base/upload_element.h ('k') | webkit/blob/blob_storage_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/upload_element.cc
diff --git a/net/base/upload_element.cc b/net/base/upload_element.cc
index afa5b0a3235d9c18a7d86b0ba9deb2b590d3cf73..b6bdbeda1d1ac31e436ec15f49deecc9df28b382 100644
--- a/net/base/upload_element.cc
+++ b/net/base/upload_element.cc
@@ -15,6 +15,8 @@ namespace net {
UploadElement::UploadElement()
: type_(TYPE_BYTES),
+ bytes_start_(NULL),
+ bytes_length_(0),
file_range_offset_(0),
file_range_length_(kuint64max),
is_last_chunk_(false),
@@ -38,9 +40,8 @@ UploadElement::~UploadElement() {
void UploadElement::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;
}
@@ -49,10 +50,7 @@ uint64 UploadElement::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_);
@@ -146,9 +144,8 @@ int UploadElement::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;
« no previous file with comments | « net/base/upload_element.h ('k') | webkit/blob/blob_storage_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698