OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromecast/base/metrics/cast_metrics_helper.h" | 5 #include "chromecast/base/metrics/cast_metrics_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 *sdk_version = tokens[3]; | 71 *sdk_version = tokens[3]; |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 // static | 75 // static |
76 std::string CastMetricsHelper::EncodeAppInfoIntoMetricsName( | 76 std::string CastMetricsHelper::EncodeAppInfoIntoMetricsName( |
77 const std::string& action_name, | 77 const std::string& action_name, |
78 const std::string& app_id, | 78 const std::string& app_id, |
79 const std::string& session_id, | 79 const std::string& session_id, |
80 const std::string& sdk_version) { | 80 const std::string& sdk_version) { |
81 std::vector<std::string> parts; | 81 std::string result(action_name); |
82 parts.push_back(action_name); | 82 result.push_back(kMetricsNameAppInfoDelimiter); |
83 parts.push_back(app_id); | 83 result.append(app_id); |
84 parts.push_back(session_id); | 84 result.push_back(kMetricsNameAppInfoDelimiter); |
85 parts.push_back(sdk_version); | 85 result.append(session_id); |
86 return JoinString(parts, kMetricsNameAppInfoDelimiter); | 86 result.push_back(kMetricsNameAppInfoDelimiter); |
| 87 result.append(sdk_version); |
| 88 return result; |
87 } | 89 } |
88 | 90 |
89 // static | 91 // static |
90 CastMetricsHelper* CastMetricsHelper::GetInstance() { | 92 CastMetricsHelper* CastMetricsHelper::GetInstance() { |
91 DCHECK(g_instance); | 93 DCHECK(g_instance); |
92 return g_instance; | 94 return g_instance; |
93 } | 95 } |
94 | 96 |
95 CastMetricsHelper::CastMetricsHelper( | 97 CastMetricsHelper::CastMetricsHelper( |
96 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 98 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 const base::TimeDelta& value) { | 305 const base::TimeDelta& value) { |
304 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. | 306 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. |
305 LogTimeHistogramEvent(name, value, | 307 LogTimeHistogramEvent(name, value, |
306 base::TimeDelta::FromMilliseconds(10), | 308 base::TimeDelta::FromMilliseconds(10), |
307 base::TimeDelta::FromMinutes(3), | 309 base::TimeDelta::FromMinutes(3), |
308 50); | 310 50); |
309 } | 311 } |
310 | 312 |
311 } // namespace metrics | 313 } // namespace metrics |
312 } // namespace chromecast | 314 } // namespace chromecast |
OLD | NEW |