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

Side by Side Diff: chrome/browser/performance_monitor/metric_details.cc

Issue 10805050: Chrome Performance Monitor: MetricDetails refactor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months 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 unified diff | Download patch
OLDNEW
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698