Chromium Code Reviews| Index: chromecast/base/metrics/cast_metrics_helper.h |
| diff --git a/chromecast/base/metrics/cast_metrics_helper.h b/chromecast/base/metrics/cast_metrics_helper.h |
| index 9bacdcbe4b8a00e5c933e2337aed780879f63438..71affde52bc8b39c5ff83a340b49960081220104 100644 |
| --- a/chromecast/base/metrics/cast_metrics_helper.h |
| +++ b/chromecast/base/metrics/cast_metrics_helper.h |
| @@ -31,6 +31,16 @@ class CastMetricsHelper { |
| typedef base::Callback<void(const std::string&)> RecordActionCallback; |
| + struct MetricsAppInfo { |
| + MetricsAppInfo(); |
| + ~MetricsAppInfo(); |
|
byungchul
2014/12/11 00:15:26
Not necessary
gfhuang
2014/12/11 02:59:39
Done.
|
| + |
| + std::string action_name; |
| + std::string app_id; |
| + std::string session_id; |
| + std::string sdk_version; |
| + }; |
| + |
| class MetricsSink { |
| public: |
| virtual ~MetricsSink() {} |
| @@ -45,6 +55,14 @@ class CastMetricsHelper { |
| int num_buckets) = 0; |
| }; |
| + // Delimiter character used in GetMetricsNameWithAppInfo(). |
| + static const char kMetricsNameAppInfoDelimiter; |
|
gunsch
2014/12/10 22:43:58
will this be referenced outside this file? I would
gfhuang
2014/12/11 02:59:39
Done.
|
| + |
| + // Decodes action_name/app_id/session_id/sdk_version from metrics name |
| + // generated from GetMetricsNameWithAppInfo(). |
| + static MetricsAppInfo GetAppInfoFromMetricsName( |
| + const std::string& metrics_name); |
|
byungchul
2014/12/11 00:15:26
Do we prefer structure copy? Why not get out param
gfhuang
2014/12/11 02:59:39
Done.
byungchul
2014/12/11 18:35:49
Though I meant passing the pointer of the structur
gfhuang
2014/12/11 19:20:26
Ack. define struct has an extra burden to maintain
|
| + |
| static CastMetricsHelper* GetInstance(); |
| explicit CastMetricsHelper( |
| @@ -53,6 +71,10 @@ class CastMetricsHelper { |
| // This function stores the name and startup time of the active application. |
| virtual void TagAppStart(const std::string& app_name); |
| + // This function updates the info for current active application. |
| + virtual void UpdateCurrentAppInfo(const std::string& app_id, |
| + const std::string& session_id, |
| + const std::string& sdk_version); |
| // Logs UMA record for media play/pause user actions. |
| virtual void LogMediaPlay(); |
| @@ -81,6 +103,9 @@ class CastMetricsHelper { |
| virtual std::string GetMetricsNameWithAppName( |
| const std::string& prefix, |
| const std::string& suffix) const; |
| + // Returns metrics name with app_id/session_id/sdk_version. |
| + virtual std::string GetMetricsNameWithAppInfo( |
| + const std::string& action_name) const; |
| // Provides a MetricsSink instance to delegate UMA event logging. |
| // Once the delegate interface is set, CastMetricsHelper will not log UMA |
| @@ -118,6 +143,9 @@ class CastMetricsHelper { |
| // Currently running app name. Used to construct histogram name. |
| std::string app_name_; |
| + std::string app_id_; |
| + std::string session_id_; |
| + std::string sdk_version_; |
| // Whether a new app start time has been stored but not recorded. |
| // After the startup time has been used to generate an UMA event, |