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

Side by Side Diff: base/metrics/histogram.cc

Issue 6869009: Introduce the ANNOTATE_LEAKING_OBJECT_PTR annotation that can be used to mark (Closed) Base URL: svn://svn.chromium.org/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 | « base/debug/leak_annotations.h ('k') | no next file » | 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) 2011 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 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 // See header file for details and examples. 8 // See header file for details and examples.
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 11
12 #include <math.h> 12 #include <math.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 #include <string> 15 #include <string>
16 16
17 #include "base/debug/leak_annotations.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/pickle.h" 19 #include "base/pickle.h"
19 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
20 #include "base/synchronization/lock.h" 21 #include "base/synchronization/lock.h"
21 22
22 namespace base { 23 namespace base {
23 24
24 // Static table of checksums for all possible 8 bit bytes. 25 // Static table of checksums for all possible 8 bit bytes.
25 const uint32 Histogram::kCrcTable[256] = {0x0, 0x77073096L, 0xee0e612cL, 26 const uint32 Histogram::kCrcTable[256] = {0x0, 0x77073096L, 0xee0e612cL,
26 0x990951baL, 0x76dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0xedb8832L, 27 0x990951baL, 0x76dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0xedb8832L,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 Histogram* tentative_histogram = 95 Histogram* tentative_histogram =
95 new Histogram(name, minimum, maximum, bucket_count); 96 new Histogram(name, minimum, maximum, bucket_count);
96 tentative_histogram->InitializeBucketRange(); 97 tentative_histogram->InitializeBucketRange();
97 tentative_histogram->SetFlags(flags); 98 tentative_histogram->SetFlags(flags);
98 histogram = 99 histogram =
99 StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram); 100 StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram);
100 } 101 }
101 102
102 DCHECK_EQ(HISTOGRAM, histogram->histogram_type()); 103 DCHECK_EQ(HISTOGRAM, histogram->histogram_type());
103 DCHECK(histogram->HasConstructorArguments(minimum, maximum, bucket_count)); 104 DCHECK(histogram->HasConstructorArguments(minimum, maximum, bucket_count));
105 ANNOTATE_LEAKING_OBJECT_PTR(histogram); // see crbug.com/79322
jar (doing other things) 2011/04/15 15:53:37 There are actually 3 distinct FactoryGet routines
Alexander Potapenko 2011/04/18 09:45:13 There are actually four of them, as I can see: Hi
104 return histogram; 106 return histogram;
105 } 107 }
106 108
107 Histogram* Histogram::FactoryTimeGet(const std::string& name, 109 Histogram* Histogram::FactoryTimeGet(const std::string& name,
108 TimeDelta minimum, 110 TimeDelta minimum,
109 TimeDelta maximum, 111 TimeDelta maximum,
110 size_t bucket_count, 112 size_t bucket_count,
111 Flags flags) { 113 Flags flags) {
112 return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), 114 return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(),
113 bucket_count, flags); 115 bucket_count, flags);
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 } 1124 }
1123 1125
1124 // static 1126 // static
1125 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; 1127 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL;
1126 // static 1128 // static
1127 base::Lock* StatisticsRecorder::lock_ = NULL; 1129 base::Lock* StatisticsRecorder::lock_ = NULL;
1128 // static 1130 // static
1129 bool StatisticsRecorder::dump_on_exit_ = false; 1131 bool StatisticsRecorder::dump_on_exit_ = false;
1130 1132
1131 } // namespace base 1133 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/leak_annotations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698