Chromium Code Reviews

Unified Diff: components/data_use_measurement/content/data_use_measurement.h

Issue 2338563003: Record UMA for total data usage consumed by Chromium (Closed)
Patch Set: PS Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: components/data_use_measurement/content/data_use_measurement.h
diff --git a/components/data_use_measurement/content/data_use_measurement.h b/components/data_use_measurement/content/data_use_measurement.h
index c115dc4bf27927ee2d8adc74b078b3d4ee0a26ba..b1186c96dbd957e468f27ddc2a5add6a8d50bf5b 100644
--- a/components/data_use_measurement/content/data_use_measurement.h
+++ b/components/data_use_measurement/content/data_use_measurement.h
@@ -44,6 +44,11 @@ class DataUseMeasurement {
void OnBeforeRedirect(const net::URLRequest& request,
const GURL& new_location);
+ // Called when data is received or sent on the network, respectively.
+ void OnNetworkBytesReceived(const net::URLRequest& request,
+ int64_t bytes_received);
+ void OnNetworkBytesSent(const net::URLRequest& request, int64_t bytes_sent);
+
// Indicates that |request| has been completed or failed.
void OnCompleted(const net::URLRequest& request, bool started);
@@ -99,6 +104,11 @@ class DataUseMeasurement {
bool is_connection_cellular,
int64_t message_size) const;
+ // Records the count of bytes received and sent by Chrome on the network as
+ // reported by the operating system.
+ void RecordNetworkBytesReceivedOS();
+ void RecordNetworkBytesSentOS();
+
// Callback for updating data use prefs.
// TODO(rajendrant): If a similar mechanism would need be used for components
// other than metrics, then the better approach would be to refactor this
@@ -113,6 +123,12 @@ class DataUseMeasurement {
// ApplicationStatusListener used to monitor whether the application is in the
// foreground or in the background. It is owned by DataUseMeasurement.
std::unique_ptr<base::android::ApplicationStatusListener> app_listener_;
+
+ // Number of bytes received and sent by Chromium as reported by the operating
+ // system when it was last queried. Set to 0 if the operating system was never
+ // queried.
+ int64_t rx_bytes_os_;
+ int64_t tx_bytes_os_;
#endif
DISALLOW_COPY_AND_ASSIGN(DataUseMeasurement);

Powered by Google App Engine