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

Unified Diff: chromecast/base/metrics/cast_metrics_helper.cc

Issue 786233003: Add UpdateCurrentAppInfo() interface to record info about current app, including (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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: chromecast/base/metrics/cast_metrics_helper.cc
diff --git a/chromecast/base/metrics/cast_metrics_helper.cc b/chromecast/base/metrics/cast_metrics_helper.cc
index 4cf26f194d3533952d03e1808d0f50391b11faf5..12aba55f4719c62ac1ca4b3ea59cb78daeef49f0 100644
--- a/chromecast/base/metrics/cast_metrics_helper.cc
+++ b/chromecast/base/metrics/cast_metrics_helper.cc
@@ -68,14 +68,27 @@ void CastMetricsHelper::TagAppStart(const std::string& arg_app_name) {
app_name_ = arg_app_name;
app_start_time_ = base::TimeTicks::Now();
new_startup_time_ = true;
+ // Clear app info
+ app_id_ = "";
byungchul 2014/12/10 05:39:41 app_id_.clear();
gunsch 2014/12/10 16:54:18 Alternately, you could use UpdateCurrentAppInfo(""
gfhuang 2014/12/10 22:02:41 Done.
+ session_id_ = "";
byungchul 2014/12/10 05:39:41 ditto
+ sdk_version_ = "";
byungchul 2014/12/10 05:39:40 ditto
+}
+
+void CastMetricsHelper::UpdateCurrentAppInfo(const std::string& app_id,
+ const std::string& session_id,
+ const std::string& sdk_version) {
+ MAKE_SURE_THREAD(UpdateCurrentAppInfo, app_id, session_id, sdk_version);
+ app_id_ = app_id;
+ session_id_ = session_id;
+ sdk_version_ = sdk_version;
}
void CastMetricsHelper::LogMediaPlay() {
- RecordSimpleAction(GetMetricsNameWithAppName("MediaPlay", ""));
+ RecordSimpleAction(GetMetricsNameWithAppInfo("MediaPlay"));
}
void CastMetricsHelper::LogMediaPause() {
- RecordSimpleAction(GetMetricsNameWithAppName("MediaPause", ""));
+ RecordSimpleAction(GetMetricsNameWithAppInfo("MediaPause"));
}
void CastMetricsHelper::LogTimeToDisplayVideo() {
@@ -186,6 +199,12 @@ std::string CastMetricsHelper::GetMetricsNameWithAppName(
return metrics_name;
}
+std::string CastMetricsHelper::GetMetricsNameWithAppInfo(
+ const std::string& action_name) const {
+ DCHECK(message_loop_proxy_->BelongsToCurrentThread());
+ return action_name + "#" + app_id_ + "#" + session_id_ + "#" + sdk_version_;
byungchul 2014/12/10 05:39:40 Please define a constant for delimiter, '#' for so
gunsch 2014/12/10 16:54:18 Aside: I saw that you're parsing this in a differe
gfhuang 2014/12/10 22:02:41 Done.
+}
+
void CastMetricsHelper::SetMetricsSink(MetricsSink* delegate) {
MAKE_SURE_THREAD(SetMetricsSink, delegate);
metrics_sink_ = delegate;

Powered by Google App Engine
This is Rietveld 408576698