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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 std::string* app_id, | 47 std::string* app_id, |
48 std::string* session_id, | 48 std::string* session_id, |
49 std::string* sdk_version) { | 49 std::string* sdk_version) { |
50 DCHECK(action_name); | 50 DCHECK(action_name); |
51 DCHECK(app_id); | 51 DCHECK(app_id); |
52 DCHECK(session_id); | 52 DCHECK(session_id); |
53 DCHECK(sdk_version); | 53 DCHECK(sdk_version); |
54 if (metrics_name.find(kMetricsNameAppInfoDelimiter) == std::string::npos) | 54 if (metrics_name.find(kMetricsNameAppInfoDelimiter) == std::string::npos) |
55 return false; | 55 return false; |
56 | 56 |
57 std::vector<std::string> tokens; | 57 std::vector<std::string> tokens = base::SplitString( |
58 base::SplitString(metrics_name, kMetricsNameAppInfoDelimiter, &tokens); | 58 metrics_name, std::string(1, kMetricsNameAppInfoDelimiter), |
| 59 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
59 DCHECK_EQ(tokens.size(), 4u); | 60 DCHECK_EQ(tokens.size(), 4u); |
60 // The order of tokens should match EncodeAppInfoIntoMetricsName(). | 61 // The order of tokens should match EncodeAppInfoIntoMetricsName(). |
61 *action_name = tokens[0]; | 62 *action_name = tokens[0]; |
62 *app_id = tokens[1]; | 63 *app_id = tokens[1]; |
63 *session_id = tokens[2]; | 64 *session_id = tokens[2]; |
64 *sdk_version = tokens[3]; | 65 *sdk_version = tokens[3]; |
65 return true; | 66 return true; |
66 } | 67 } |
67 | 68 |
68 // static | 69 // static |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 const base::TimeDelta& value) { | 248 const base::TimeDelta& value) { |
248 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. | 249 // Follow UMA_HISTOGRAM_MEDIUM_TIMES definition. |
249 LogTimeHistogramEvent(name, value, | 250 LogTimeHistogramEvent(name, value, |
250 base::TimeDelta::FromMilliseconds(10), | 251 base::TimeDelta::FromMilliseconds(10), |
251 base::TimeDelta::FromMinutes(3), | 252 base::TimeDelta::FromMinutes(3), |
252 50); | 253 50); |
253 } | 254 } |
254 | 255 |
255 } // namespace metrics | 256 } // namespace metrics |
256 } // namespace chromecast | 257 } // namespace chromecast |
OLD | NEW |