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

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

Issue 2399783003: Split the data use into foreground, background and unknown (Closed)
Patch Set: Addressed kundaji comments Created 4 years, 2 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: 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 8f24a62e192b2b4e0f4ddf2315231ddb54739962..3343b8fdb9849ba46492e99df934ff9be6491a49 100644
--- a/components/data_use_measurement/content/data_use_measurement.h
+++ b/components/data_use_measurement/content/data_use_measurement.h
@@ -81,11 +81,11 @@ class DataUseMeasurement {
// ("Downstream") path, whether the app was in the "Foreground" or
// "Background", and whether a "Cellular" or "WiFi" network was use. For
// example, "Prefix.Upstream.Foreground.Cellular" is a possible output.
- // |started_in_foreground| indicates if the request started when the app was
- // in foreground.
+ // |app_state| indicates the app state which can be foreground, background, or
+ // unknown.
std::string GetHistogramName(const char* prefix,
TrafficDirection dir,
- bool started_in_foreground,
+ DataUseUserData::AppState app_state,
bool is_connection_cellular) const;
#if defined(OS_ANDROID)
@@ -100,18 +100,25 @@ class DataUseMeasurement {
#endif
// Records the data use of the |request|, thus |request| must be non-null.
- void ReportDataUseUMA(const net::URLRequest& request) const;
+ // |dir| is the direction (which is upstream or downstream) and |bytes| is the
+ // number of bytes in the direction.
+ void ReportDataUseUMA(const net::URLRequest& request,
+ TrafficDirection dir,
+ int64_t bytes) const;
+
+ // Updates the data use of the |request|, thus |request| must be non-null.
+ void UpdateDataUsePrefs(const net::URLRequest& request) const;
// A helper function used to record data use of services. It gets the size of
// exchanged message, its direction (which is upstream or downstream) and
// reports to two histogram groups. DataUse.MessageSize.ServiceName and
// DataUse.Services.{Dimensions}. In the second one, services are buckets.
- // |started_in_foreground| indicates if the request started when the app was
- // in foreground.
+ // |app_state| indicates the app state which can be foreground, background, or
+ // unknown.
void ReportDataUsageServices(
data_use_measurement::DataUseUserData::ServiceName service,
TrafficDirection dir,
- bool started_in_foreground,
+ DataUseUserData::AppState app_state,
bool is_connection_cellular,
int64_t message_size) const;

Powered by Google App Engine
This is Rietveld 408576698