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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 1284993005: Notify NetworkDelegate when bytes have been received over the network. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed empty cronet OnRawBytesRead implementation Created 5 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/url_request/url_request_http_job.h ('k') | net/url_request/url_request_http_job_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index c9aa4cc2ed326c6518658e1a01917401f97711cf..982971edbcd7c397c66e6c0524da4fee314edab6 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -197,6 +197,7 @@ URLRequestHttpJob::URLRequestHttpJob(
awaiting_callback_(false),
http_user_agent_settings_(http_user_agent_settings),
backoff_manager_(request->context()->backoff_manager()),
+ total_received_bytes_from_previous_transactions_(0),
weak_factory_(this) {
URLRequestThrottlerManager* manager = request->context()->throttler_manager();
if (manager)
@@ -421,6 +422,9 @@ void URLRequestHttpJob::DestroyTransaction() {
DCHECK(transaction_.get());
DoneWithRequest(ABORTED);
+
+ total_received_bytes_from_previous_transactions_ +=
+ transaction_->GetTotalReceivedBytes();
transaction_.reset();
response_info_ = NULL;
receive_headers_end_ = base::TimeTicks();
@@ -1359,10 +1363,11 @@ bool URLRequestHttpJob::GetFullRequestHeaders(
}
int64 URLRequestHttpJob::GetTotalReceivedBytes() const {
- if (!transaction_)
- return 0;
-
- return transaction_->GetTotalReceivedBytes();
+ int64_t total_received_bytes =
+ total_received_bytes_from_previous_transactions_;
+ if (transaction_)
+ total_received_bytes += transaction_->GetTotalReceivedBytes();
+ return total_received_bytes;
}
void URLRequestHttpJob::DoneReading() {
« no previous file with comments | « net/url_request/url_request_http_job.h ('k') | net/url_request/url_request_http_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698