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

Unified Diff: net/url_request/url_request_job.h

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: Addressed tbansal and bengr comments 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
Index: net/url_request/url_request_job.h
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h
index e7f40823c6926876741bae206ce12cdd65a31212..9936f38f6e0a159ed431844de6084f170e002247 100644
--- a/net/url_request/url_request_job.h
+++ b/net/url_request/url_request_job.h
@@ -5,6 +5,7 @@
#ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_
#define NET_URL_REQUEST_URL_REQUEST_JOB_H_
+#include <stdint.h>
tbansal1 2015/08/18 00:49:49 nit: I believe the preference is to separate .h fr
sclittle 2015/08/18 18:06:16 Done.
#include <string>
#include <vector>
@@ -353,6 +354,12 @@ class NET_EXPORT URLRequestJob
// reflects bytes read even when there is no filter.
int64 postfilter_bytes_read() const { return postfilter_bytes_read_; }
+ // Notify the network delegate that more bytes have been received over the
+ // network, if bytes have been received since the previous notification.
+ // TODO(sclittle): Have this method also notify about sent bytes once
+ // URLRequestJob::GetTotalSentBytes has been implemented (crbug.com/518897).
+ void MaybeNotifyNetworkBytes();
+
// The request that initiated this job. This value MAY BE NULL if the
// request was released by DetachRequest().
URLRequest* request_;
@@ -434,6 +441,11 @@ class NET_EXPORT URLRequestJob
// The network delegate to use with this request, if any.
NetworkDelegate* network_delegate_;
+ // The value from GetTotalReceivedBytes() the last time
+ // MaybeNotifyNetworkBytes() was called. Used to calculate how bytes have been
+ // newly received since the last notification.
+ int64_t last_notified_total_received_bytes_;
+
base::WeakPtrFactory<URLRequestJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(URLRequestJob);

Powered by Google App Engine
This is Rietveld 408576698