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

Side by Side Diff: chrome/browser/extensions/extension_metrics_module.cc

Issue 6780035: Use lock-free lazy initialization for static histogram references (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_metrics_apitest.cc ('k') | chrome/browser/jankometer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_metrics_module.h" 5 #include "chrome/browser/extensions/extension_metrics_module.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 #include "chrome/browser/metrics/user_metrics.h" 10 #include "chrome/browser/metrics/user_metrics.h"
11 #include "chrome/browser/ui/options/options_util.h" 11 #include "chrome/browser/ui/options/options_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return true; 68 return true;
69 } 69 }
70 70
71 bool MetricsHistogramHelperFunction::RecordValue(const std::string& name, 71 bool MetricsHistogramHelperFunction::RecordValue(const std::string& name,
72 Histogram::ClassType type, 72 Histogram::ClassType type,
73 int min, 73 int min,
74 int max, 74 int max,
75 size_t buckets, 75 size_t buckets,
76 int sample) { 76 int sample) {
77 std::string full_name = BuildMetricName(name, GetExtension()); 77 std::string full_name = BuildMetricName(name, GetExtension());
78 scoped_refptr<Histogram> counter; 78 Histogram* counter;
79 if (type == Histogram::LINEAR_HISTOGRAM) { 79 if (type == Histogram::LINEAR_HISTOGRAM) {
80 counter = LinearHistogram::FactoryGet(full_name, 80 counter = LinearHistogram::FactoryGet(full_name,
81 min, 81 min,
82 max, 82 max,
83 buckets, 83 buckets,
84 Histogram::kUmaTargetedHistogramFlag); 84 Histogram::kUmaTargetedHistogramFlag);
85 } else { 85 } else {
86 counter = Histogram::FactoryGet(full_name, 86 counter = Histogram::FactoryGet(full_name,
87 min, 87 min,
88 max, 88 max,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return RecordValue(name, Histogram::HISTOGRAM, 1, kThreeMinMs, 50, sample); 162 return RecordValue(name, Histogram::HISTOGRAM, 1, kThreeMinMs, 50, sample);
163 } 163 }
164 164
165 bool MetricsRecordLongTimeFunction::RunImpl() { 165 bool MetricsRecordLongTimeFunction::RunImpl() {
166 std::string name; 166 std::string name;
167 int sample; 167 int sample;
168 EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample)); 168 EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
169 static const int kOneHourMs = 60 * 60 * 1000; 169 static const int kOneHourMs = 60 * 60 * 1000;
170 return RecordValue(name, Histogram::HISTOGRAM, 1, kOneHourMs, 50, sample); 170 return RecordValue(name, Histogram::HISTOGRAM, 1, kOneHourMs, 50, sample);
171 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_metrics_apitest.cc ('k') | chrome/browser/jankometer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698