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 // 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" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (*declared_max <= 0 || | 57 if (*declared_max <= 0 || |
58 *declared_min <= 0 || | 58 *declared_min <= 0 || |
59 *declared_max < *declared_min || | 59 *declared_max < *declared_min || |
60 INT_MAX / sizeof(HistogramBase::Count) <= *bucket_count || | 60 INT_MAX / sizeof(HistogramBase::Count) <= *bucket_count || |
61 *bucket_count < 2) { | 61 *bucket_count < 2) { |
62 DLOG(ERROR) << "Values error decoding Histogram: " << histogram_name; | 62 DLOG(ERROR) << "Values error decoding Histogram: " << histogram_name; |
63 return false; | 63 return false; |
64 } | 64 } |
65 | 65 |
66 // We use the arguments to find or create the local version of the histogram | 66 // We use the arguments to find or create the local version of the histogram |
67 // in this process, so we need to clear the IPC flag. | 67 // in this process, so we need to clear any IPC flag. |
68 DCHECK(*flags & HistogramBase::kIPCSerializationSourceFlag); | |
69 *flags &= ~HistogramBase::kIPCSerializationSourceFlag; | 68 *flags &= ~HistogramBase::kIPCSerializationSourceFlag; |
70 | 69 |
71 return true; | 70 return true; |
72 } | 71 } |
73 | 72 |
74 bool ValidateRangeChecksum(const HistogramBase& histogram, | 73 bool ValidateRangeChecksum(const HistogramBase& histogram, |
75 uint32_t range_checksum) { | 74 uint32_t range_checksum) { |
76 const Histogram& casted_histogram = | 75 const Histogram& casted_histogram = |
77 static_cast<const Histogram&>(histogram); | 76 static_cast<const Histogram&>(histogram); |
78 | 77 |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 Sample sample = custom_ranges[i]; | 1178 Sample sample = custom_ranges[i]; |
1180 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) | 1179 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) |
1181 return false; | 1180 return false; |
1182 if (sample != 0) | 1181 if (sample != 0) |
1183 has_valid_range = true; | 1182 has_valid_range = true; |
1184 } | 1183 } |
1185 return has_valid_range; | 1184 return has_valid_range; |
1186 } | 1185 } |
1187 | 1186 |
1188 } // namespace base | 1187 } // namespace base |
OLD | NEW |