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

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

Issue 2865913002: Support for identifying traffic type in data use ascriber (Closed)
Patch Set: Addressed comments 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..cc1d87a242ef923a12490d633be662130f12e32b 100644
--- a/components/data_use_measurement/core/data_use.h
+++ b/components/data_use_measurement/core/data_use.h
@@ -18,7 +18,21 @@ namespace data_use_measurement {
// Class to store total network data used by some entity.
class DataUse {
public:
- DataUse();
+ enum TrafficType {
tbansal1 2017/05/12 15:59:58 can this be enum class? https://groups.google.com/
rajendrant 2017/05/16 00:50:08 Done.
+ // Unknown.
+ UNKNOWN,
tbansal1 2017/05/12 15:59:58 May be add a TODO to record metrics on the distrib
rajendrant 2017/05/16 00:50:08 Done.
+
+ // User initiated traffic.
+ USER_TRAFFIC,
+
+ // Chrome services.
+ SERVICES,
+
+ // Fetch from ServiceWorker.
+ SERVICE_WORKER,
+ };
+
+ DataUse(TrafficType traffic_type);
tbansal1 2017/05/12 15:59:58 explicit
rajendrant 2017/05/16 00:50:08 Done.
DataUse(const DataUse& other);
~DataUse();
@@ -39,11 +53,14 @@ class DataUse {
int64_t total_bytes_sent() const { return total_bytes_sent_; }
+ TrafficType traffic_type() { return traffic_type_; }
tbansal1 2017/05/12 15:59:58 const function
rajendrant 2017/05/16 00:50:08 Done.
+
private:
friend class DataUseRecorder;
tbansal1 2017/05/12 15:59:58 TODO to remove this friend. This probably means th
rajendrant 2017/05/16 00:50:08 Done.
GURL url_;
std::string description_;
+ const TrafficType traffic_type_;
int64_t total_bytes_sent_;
int64_t total_bytes_received_;
tbansal1 2017/05/12 15:59:58 May be add a TODO to add thread checker.
tbansal1 2017/05/12 15:59:58 DISALLOW_COPY_AND_ASSIGN or override the assignmen
rajendrant 2017/05/16 00:50:08 Done.
rajendrant 2017/05/16 00:50:08 Thread checker could be too much for this class. T

Powered by Google App Engine
This is Rietveld 408576698