OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/performance_monitor/metric_details.h" | 5 #include "chrome/browser/performance_monitor/metric_details.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/performance_monitor/constants.h" | 8 #include "chrome/browser/performance_monitor/constants.h" |
9 | 9 |
10 namespace performance_monitor { | 10 namespace performance_monitor { |
11 namespace { | 11 namespace { |
12 | 12 |
13 // Keep this array synced with MetricTypes in the header file. | 13 // Keep this array synced with MetricTypes in the header file. |
14 // TODO(mtytel): i18n. | 14 // TODO(mtytel): i18n. |
15 const char* kMetricTypeNames[] = { | 15 const MetricDetails kMetricDetailsList[] = { |
16 kSampleMetricName | 16 {kSampleMetricName, kSampleMetricDescription, "units", 100.0} |
17 }; | 17 }; |
18 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kMetricTypeNames) == METRIC_NUMBER_OF_METRICS, | 18 COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kMetricDetailsList) == METRIC_NUMBER_OF_METRICS, |
19 metric_names_incorrect_size); | 19 metric_names_incorrect_size); |
20 | 20 |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 const char* MetricTypeToString(MetricType metric_type) { | 23 const MetricDetails* GetMetricDetails(MetricType metric_type) { |
24 DCHECK_GT(METRIC_NUMBER_OF_METRICS, metric_type); | 24 DCHECK_GT(METRIC_NUMBER_OF_METRICS, metric_type); |
25 return kMetricTypeNames[metric_type]; | 25 return &kMetricDetailsList[metric_type]; |
26 } | |
27 | |
28 MetricDetails::MetricDetails() { | |
29 } | |
30 | |
31 MetricDetails::MetricDetails(const std::string& metric_name, | |
32 const std::string& metric_description) | |
33 : name(metric_name), | |
34 description(metric_description) { | |
35 } | |
36 | |
37 MetricDetails::~MetricDetails() { | |
38 } | 26 } |
39 | 27 |
40 } // namespace performance_monitor | 28 } // namespace performance_monitor |
OLD | NEW |