| 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::string result(action_name); | 81 std::vector<std::string> parts; |
| 82 result.push_back(kMetricsNameAppInfoDelimiter); | 82 parts.push_back(action_name); |
| 83 result.append(app_id); | 83 parts.push_back(app_id); |
| 84 result.push_back(kMetricsNameAppInfoDelimiter); | 84 parts.push_back(session_id); |
| 85 result.append(session_id); | 85 parts.push_back(sdk_version); |
| 86 result.push_back(kMetricsNameAppInfoDelimiter); | 86 return JoinString(parts, kMetricsNameAppInfoDelimiter); |
| 87 result.append(sdk_version); | |
| 88 return result; | |
| 89 } | 87 } |
| 90 | 88 |
| 91 // static | 89 // static |
| 92 CastMetricsHelper* CastMetricsHelper::GetInstance() { | 90 CastMetricsHelper* CastMetricsHelper::GetInstance() { |
| 93 DCHECK(g_instance); | 91 DCHECK(g_instance); |
| 94 return g_instance; | 92 return g_instance; |
| 95 } | 93 } |
| 96 | 94 |
| 97 CastMetricsHelper::CastMetricsHelper( | 95 CastMetricsHelper::CastMetricsHelper( |
| 98 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 96 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 const base::TimeDelta& value) { | 303 const base::TimeDelta& value) { |
| 306 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. | 304 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. |
| 307 LogTimeHistogramEvent(name, value, | 305 LogTimeHistogramEvent(name, value, |
| 308 base::TimeDelta::FromMilliseconds(10), | 306 base::TimeDelta::FromMilliseconds(10), |
| 309 base::TimeDelta::FromMinutes(3), | 307 base::TimeDelta::FromMinutes(3), |
| 310 50); | 308 50); |
| 311 } | 309 } |
| 312 | 310 |
| 313 } // namespace metrics | 311 } // namespace metrics |
| 314 } // namespace chromecast | 312 } // namespace chromecast |
| OLD | NEW |