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

Side by Side Diff: base/metrics/statistics_recorder.h

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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
« no previous file with comments | « base/lazy_instance_unittest.cc ('k') | base/metrics/user_metrics.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) 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 // StatisticsRecorder holds all Histograms and BucketRanges that are used by 5 // StatisticsRecorder holds all Histograms and BucketRanges that are used by
6 // Histograms in the system. It provides a general place for 6 // Histograms in the system. It provides a general place for
7 // Histograms/BucketRanges to register, and supports a global API for accessing 7 // Histograms/BucketRanges to register, and supports a global API for accessing
8 // (i.e., dumping, or graphing) the data. 8 // (i.e., dumping, or graphing) the data.
9 9
10 #ifndef BASE_METRICS_STATISTICS_RECORDER_H_ 10 #ifndef BASE_METRICS_STATISTICS_RECORDER_H_
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 private: 210 private:
211 // We keep a map of callbacks to histograms, so that as histograms are 211 // We keep a map of callbacks to histograms, so that as histograms are
212 // created, we can set the callback properly. 212 // created, we can set the callback properly.
213 typedef std::map<std::string, OnSampleCallback> CallbackMap; 213 typedef std::map<std::string, OnSampleCallback> CallbackMap;
214 214
215 // We keep all |bucket_ranges_| in a map, from checksum to a list of 215 // We keep all |bucket_ranges_| in a map, from checksum to a list of
216 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in 216 // |bucket_ranges_|. Checksum is calculated from the |ranges_| in
217 // |bucket_ranges_|. 217 // |bucket_ranges_|.
218 typedef std::map<uint32_t, std::list<const BucketRanges*>*> RangesMap; 218 typedef std::map<uint32_t, std::list<const BucketRanges*>*> RangesMap;
219 219
220 friend struct DefaultLazyInstanceTraits<StatisticsRecorder>; 220 friend struct LazyInstanceTraitsBase<StatisticsRecorder>;
221 friend class StatisticsRecorderTest; 221 friend class StatisticsRecorderTest;
222 222
223 // Imports histograms from global persistent memory. The global lock must 223 // Imports histograms from global persistent memory. The global lock must
224 // not be held during this call. 224 // not be held during this call.
225 static void ImportGlobalPersistentHistograms(); 225 static void ImportGlobalPersistentHistograms();
226 226
227 // The constructor just initializes static members. Usually client code should 227 // The constructor just initializes static members. Usually client code should
228 // use Initialize to do this. But in test code, you can friend this class and 228 // use Initialize to do this. But in test code, you can friend this class and
229 // call the constructor to get a clean StatisticsRecorder. 229 // call the constructor to get a clean StatisticsRecorder.
230 StatisticsRecorder(); 230 StatisticsRecorder();
(...skipping 25 matching lines...) Expand all
256 // would do |if (!lock_) return;| which would race with 256 // would do |if (!lock_) return;| which would race with
257 // |lock_ = new Lock;| in StatisticsRecorder(). http://crbug.com/672852. 257 // |lock_ = new Lock;| in StatisticsRecorder(). http://crbug.com/672852.
258 static base::LazyInstance<base::Lock>::Leaky lock_; 258 static base::LazyInstance<base::Lock>::Leaky lock_;
259 259
260 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); 260 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder);
261 }; 261 };
262 262
263 } // namespace base 263 } // namespace base
264 264
265 #endif // BASE_METRICS_STATISTICS_RECORDER_H_ 265 #endif // BASE_METRICS_STATISTICS_RECORDER_H_
OLDNEW
« no previous file with comments | « base/lazy_instance_unittest.cc ('k') | base/metrics/user_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698