Index: net/url_request/url_fetcher_core.cc |
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc |
index de55ef779af1948b9a5ff8794075b9e7d76d48b9..0aa56eeb62411a2a1d2664f9f63028258beb186c 100644 |
--- a/net/url_request/url_fetcher_core.cc |
+++ b/net/url_request/url_fetcher_core.cc |
@@ -102,7 +102,9 @@ URLFetcherCore::URLFetcherCore(URLFetcher* fetcher, |
max_retries_on_network_changes_(0), |
current_upload_bytes_(-1), |
current_response_bytes_(0), |
- total_response_bytes_(-1) { |
+ total_response_bytes_(-1), |
bengr
2015/08/07 18:00:02
Why are these initialized to -1 and not 0?
amohammadkhan
2015/08/11 22:04:36
To be distinguishable if they are not touched at a
|
+ total_downloaded_bytes_(-1), |
+ total_sent_bytes_(-1) { |
CHECK(original_url_.is_valid()); |
} |
@@ -347,6 +349,14 @@ int URLFetcherCore::GetResponseCode() const { |
return response_code_; |
} |
+int64 URLFetcherCore::GetBytesSentSize() const { |
bengr
2015/08/07 18:00:01
GetTotalBytesSent()
amohammadkhan
2015/08/11 22:04:36
Done.
|
+ return total_sent_bytes_; |
+} |
+ |
+int64 URLFetcherCore::GetBytesReceivedSize() const { |
bengr
2015/08/07 18:00:02
GetTotalReceivedBytes()
amohammadkhan
2015/08/11 22:04:36
Done.
|
+ return total_downloaded_bytes_; |
bengr
2015/08/07 18:00:02
total_received_bytes_. In general, please be consi
amohammadkhan
2015/08/11 22:04:36
At first I had use total_received_bytes. But when
|
+} |
+ |
const ResponseCookies& URLFetcherCore::GetCookies() const { |
return cookies_; |
} |
@@ -807,6 +817,22 @@ void URLFetcherCore::CancelRequestAndInformDelegate(int result) { |
} |
void URLFetcherCore::ReleaseRequest() { |
+ if (request_) { |
+ total_received_bytes_ = request_->GetTotalReceivedBytes(); |
+ int request_body_bytes = 0; |
+ int request_header_bytes = 0; |
+ int total_request_bytes = 0; |
+ if (request_->has_upload()) { |
bengr
2015/08/07 18:00:02
Remove curly braces.
amohammadkhan
2015/08/11 22:04:36
Done.
|
+ request_body_bytes = request_->get_upload()->size(); |
+ } |
+ net::HttpRequestHeaders request_headers; |
+ if (request_->GetFullRequestHeaders(&request_headers)) { |
bengr
2015/08/07 18:00:02
Remove curly braces.
amohammadkhan
2015/08/11 22:04:36
Done.
|
+ request_header_bytes = request_headers.ToString().length(); |
+ } |
+ total_request_bytes = request_body_bytes + request_header_bytes; |
+ total_sent_bytes_ = total_request_bytes; |
+ } |
+ |
request_context_getter_->RemoveObserver(this); |
upload_progress_checker_timer_.reset(); |
request_.reset(); |