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

Unified Diff: components/data_use_measurement/core/data_use.h

Issue 2865913002: Support for identifying traffic type in data use ascriber (Closed)
Patch Set: rebaesd Created 3 years, 7 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/core/data_use.h
diff --git a/components/data_use_measurement/core/data_use.h b/components/data_use_measurement/core/data_use.h
index 18e706dc6d4d40b45e151073bcb3d8df5c560f66..d84c469fa9748533ee46c221a459a0e457c31572 100644
--- a/components/data_use_measurement/core/data_use.h
+++ b/components/data_use_measurement/core/data_use.h
@@ -18,6 +18,20 @@ namespace data_use_measurement {
// Class to store total network data used by some entity.
class DataUse {
public:
+ enum TrafficType {
+ // Unknown.
+ UNKNOWN,
+
+ // User initiated traffic.
+ USER_TRAFFIC,
+
+ // Chrome services.
+ SERVICES,
+
+ // Fetch from ServiceWorker.
+ SERVICE_WORKER,
+ };
+
DataUse();
DataUse(const DataUse& other);
~DataUse();
@@ -39,11 +53,18 @@ class DataUse {
int64_t total_bytes_sent() const { return total_bytes_sent_; }
+ TrafficType traffic_type() { return traffic_type_; }
+
+ void set_traffic_type(TrafficType traffic_type) {
+ traffic_type_ = traffic_type;
+ }
+
private:
friend class DataUseRecorder;
GURL url_;
std::string description_;
+ TrafficType traffic_type_;
tbansal1 2017/05/09 00:59:08 Is it possible to make this a const field and make
rajendrant 2017/05/11 21:16:08 Made it as const field. But still UNKNOWN type is
int64_t total_bytes_sent_;
int64_t total_bytes_received_;

Powered by Google App Engine
This is Rietveld 408576698