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

Unified Diff: webkit/glue/multipart_response_delegate.cc

Issue 6771043: Enabled actual transfer size in chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 9 years, 9 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: webkit/glue/multipart_response_delegate.cc
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index a32520ec1fba14b05eb0b310c92e214dfa4e7641..c69070c0d12de039385e06c9304b965f0450f48f 100644
--- a/webkit/glue/multipart_response_delegate.cc
+++ b/webkit/glue/multipart_response_delegate.cc
@@ -62,6 +62,7 @@ MultipartResponseDelegate::MultipartResponseDelegate(
: client_(client),
loader_(loader),
original_response_(response),
+ length_received_(0),
boundary_("--"),
first_received_data_(true),
processing_headers_(false),
@@ -76,7 +77,8 @@ MultipartResponseDelegate::MultipartResponseDelegate(
}
void MultipartResponseDelegate::OnReceivedData(const char* data,
- int data_len) {
+ int data_len,
+ int length_received) {
// stop_sending_ means that we've already received the final boundary token.
// The server should stop sending us data at this point, but if it does, we
// just throw it away.
@@ -84,6 +86,7 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
return;
data_.append(data, data_len);
+ length_received_ += length_received;
if (first_received_data_) {
// Some servers don't send a boundary token before the first chunk of
// data. We handle this case anyway (Gecko does too).
@@ -141,7 +144,9 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
// FIXME(vsevik): rename once renamed in webkit
client_->didReceiveData2(loader_,
data_.data(),
- static_cast<int>(data_length), -1);
+ static_cast<int>(data_length),
+ length_received_);
+ length_received_ = 0;
}
}
size_t boundary_end_pos = boundary_pos + boundary_.length();
@@ -173,8 +178,12 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
send_length = data_.length();
// FIXME(vsevik): rename didReceiveData2 once renamed in webkit
if (client_)
- client_->didReceiveData2(loader_, data_.data(), send_length, -1);
+ client_->didReceiveData2(loader_,
+ data_.data(),
+ send_length,
+ length_received_);
data_ = data_.substr(send_length);
+ length_received_ = 0;
}
}
@@ -185,7 +194,9 @@ void MultipartResponseDelegate::OnCompletedRequest() {
// FIXME(vsevik): rename didReceiveData2 once renamed in webkit
client_->didReceiveData2(loader_,
data_.data(),
- static_cast<int>(data_.length()), -1);
+ static_cast<int>(data_.length()),
+ length_received_);
+ length_received_ = 0;
}
}

Powered by Google App Engine
This is Rietveld 408576698