diff options
author | vsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 18:52:10 +0000 |
---|---|---|
committer | vsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 18:52:10 +0000 |
commit | 8bd0de7e38b1f56b00e2ee8c2680b9306ede5eee (patch) | |
tree | fa146e5937db671b67ba8a425e0fcc9448d98a8d /webkit/glue/multipart_response_delegate.cc | |
parent | 776c05d1347784290de3751bb753439204247591 (diff) | |
download | chromium_src-8bd0de7e38b1f56b00e2ee8c2680b9306ede5eee.zip chromium_src-8bd0de7e38b1f56b00e2ee8c2680b9306ede5eee.tar.gz chromium_src-8bd0de7e38b1f56b00e2ee8c2680b9306ede5eee.tar.bz2 |
Enabled actual transfer size in chromium
BUG=40502
TEST=Open DevTools, open site having gzip/chunked encoding, ensure transfer size is correct.
Review URL: http://codereview.chromium.org/6771043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80965 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/multipart_response_delegate.cc')
-rw-r--r-- | webkit/glue/multipart_response_delegate.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc index 53cdc3f..f45ec0f 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), + raw_data_length_(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 raw_data_length) { // 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); + raw_data_length_ += raw_data_length; 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,8 @@ void MultipartResponseDelegate::OnReceivedData(const char* data, client_->didReceiveData(loader_, data_.data(), static_cast<int>(data_length), - -1); + raw_data_length_); + raw_data_length_ = 0; } } size_t boundary_end_pos = boundary_pos + boundary_.length(); @@ -172,8 +176,12 @@ void MultipartResponseDelegate::OnReceivedData(const char* data, if (data_[data_.length() - 1] == '\n') send_length = data_.length(); if (client_) - client_->didReceiveData(loader_, data_.data(), send_length, -1); + client_->didReceiveData(loader_, + data_.data(), + send_length, + raw_data_length_); data_ = data_.substr(send_length); + raw_data_length_ = 0; } } @@ -183,7 +191,9 @@ void MultipartResponseDelegate::OnCompletedRequest() { if (!processing_headers_ && !data_.empty() && !stop_sending_ && client_) { client_->didReceiveData(loader_, data_.data(), - static_cast<int>(data_.length()), -1); + static_cast<int>(data_.length()), + raw_data_length_); + raw_data_length_ = 0; } } |