Chromium Code Reviews| Index: components/data_use_measurement/core/data_use_recorder.h |
| diff --git a/components/data_use_measurement/core/data_use_recorder.h b/components/data_use_measurement/core/data_use_recorder.h |
| index f9888cbbbfb6c906ae43094efffd0fef692f7168..0cd56e159934fc4fc94c518b7c27840aabc8e657 100644 |
| --- a/components/data_use_measurement/core/data_use_recorder.h |
| +++ b/components/data_use_measurement/core/data_use_recorder.h |
| @@ -30,11 +30,33 @@ class DataUseRecorder { |
| // Returns the actual data used by the entity being tracked. |
| DataUse& data_use() { return data_use_; } |
| + base::hash_set<net::URLRequest*>& pending_url_requests() { |
|
RyanSturm
2016/11/29 20:33:00
Can this return a const ref and be a const method?
Not at Google. Contact bengr
2016/11/30 00:21:16
Done.
|
| + return pending_url_requests_; |
| + } |
| + const net::URLRequest* main_url_request() { return main_url_request_; } |
|
RyanSturm
2016/11/29 20:33:00
const method
Not at Google. Contact bengr
2016/11/30 00:21:16
Done.
|
| + |
| + void set_main_url_request(const net::URLRequest* request) { |
| + main_url_request_ = request; |
| + } |
| // Returns whether data use is complete and no additional data can be used |
| // by the entity tracked by this recorder. For example, |
| bool IsDataUseComplete(); |
| + void AddPendingURLRequest(net::URLRequest* request); |
| + // void RemovePendingURLRequest(net::URLRequest* request); |
|
RyanSturm
2016/11/29 20:33:00
This comment should be replaced by a description,
Not at Google. Contact bengr
2016/11/30 00:21:16
Done.
|
| + void RemoveAllPendingURLRequests(); |
| + |
| + // Returns whether there are any pending URLRequests whose data use is tracked |
| + // by this DataUseRecorder. |
| + bool HasPendingURLRequest(net::URLRequest* request); |
| + |
| + // Merge another DataUseRecorder to this instance. |
| + void MergeFrom(DataUseRecorder* other); |
| + |
| + private: |
| + friend class DataUseAscriber; |
| + |
| // Methods for tracking data use sources. These sources can initiate |
| // URLRequests directly or indirectly. The entity whose data use is being |
| // tracked by this recorder may comprise of sub-entities each of which use |
| @@ -45,16 +67,6 @@ class DataUseRecorder { |
| bool HasPendingDataSource(void* source); |
| void RemovePendingDataSource(void* source); |
| - // Returns whether there are any pending URLRequests whose data use is tracked |
| - // by this DataUseRecorder. |
| - bool HasPendingURLRequest(const net::URLRequest* request); |
| - |
| - // Method to merge another DataUseRecorder to this instance. |
| - void MergeWith(DataUseRecorder* other); |
| - |
| - private: |
| - friend class DataUseAscriber; |
| - |
| // Network Delegate methods: |
| void OnBeforeUrlRequest(net::URLRequest* request); |
| void OnUrlRequestDestroyed(net::URLRequest* request); |
| @@ -62,12 +74,15 @@ class DataUseRecorder { |
| void OnNetworkBytesReceived(net::URLRequest* request, int64_t bytes_received); |
| // Pending URLRequests whose data is being tracked by this DataUseRecorder. |
| - base::hash_set<const net::URLRequest*> pending_url_requests_; |
| + base::hash_set<net::URLRequest*> pending_url_requests_; |
| // Data sources other than URLRequests, whose data is being tracked by this |
| // DataUseRecorder. |
| base::hash_set<const void*> pending_data_sources_; |
| + // For page loads this is main frame URLRequest. |
|
RyanSturm
2016/11/29 20:33:00
nit: change this to something like: The main frame
Not at Google. Contact bengr
2016/11/30 00:21:16
Done.
|
| + const net::URLRequest* main_url_request_; |
| + |
| // The network data use measured by this DataUseRecorder. |
| DataUse data_use_; |