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

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

Issue 2865913002: Support for identifying traffic type in data use ascriber (Closed)
Patch Set: compile fix 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..731e1cd0fb7a24578303cba634c26026e5a20cc4 100644
--- a/components/data_use_measurement/core/data_use.h
+++ b/components/data_use_measurement/core/data_use.h
@@ -18,8 +18,25 @@ namespace data_use_measurement {
// Class to store total network data used by some entity.
class DataUse {
public:
- DataUse();
- DataUse(const DataUse& other);
+ enum class TrafficType {
+ // Unknown type. URLRequests for arbitrary scheme such as blob, file,
+ // extensions, chrome URLs fall under this bucket - url/url_constants.cc
+ // TODO(rajendrant): Record metrics on the distribution of these type. It is
+ // also possible to remove this UNKNOWN type altogether by skipping the URL
+ // schemes that do not make use of network.
+ UNKNOWN,
+
+ // User initiated traffic.
+ USER_TRAFFIC,
+
+ // Chrome services.
+ SERVICES,
+
+ // Fetch from ServiceWorker.
+ SERVICE_WORKER,
+ };
+
+ explicit DataUse(TrafficType traffic_type);
~DataUse();
// Merge data use from another instance.
@@ -39,14 +56,21 @@ class DataUse {
int64_t total_bytes_sent() const { return total_bytes_sent_; }
+ TrafficType traffic_type() const { return traffic_type_; }
+
private:
+ // TODO(rajendrant): Remove this friend after adding member function to
+ // increment total sent/received bytes.
friend class DataUseRecorder;
GURL url_;
std::string description_;
+ const TrafficType traffic_type_;
int64_t total_bytes_sent_;
int64_t total_bytes_received_;
+
+ DISALLOW_COPY_AND_ASSIGN(DataUse);
};
} // namespace data_use_measurement
« no previous file with comments | « chrome/browser/data_use_measurement/chrome_data_use_recorder.cc ('k') | components/data_use_measurement/core/data_use.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698