| 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 #include "base/metrics/histogram_snapshot_manager.h" | 5 #include "base/metrics/histogram_snapshot_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "base/metrics/histogram_flattener.h" | 10 #include "base/metrics/histogram_flattener.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 if (HistogramBase::BUCKET_ORDER_ERROR & corruption) { | 78 if (HistogramBase::BUCKET_ORDER_ERROR & corruption) { |
| 79 // Extract fields useful during debug. | 79 // Extract fields useful during debug. |
| 80 const BucketRanges* ranges = | 80 const BucketRanges* ranges = |
| 81 static_cast<const Histogram*>(histogram)->bucket_ranges(); | 81 static_cast<const Histogram*>(histogram)->bucket_ranges(); |
| 82 std::vector<HistogramBase::Sample> ranges_copy; | 82 std::vector<HistogramBase::Sample> ranges_copy; |
| 83 for (size_t i = 0; i < ranges->size(); ++i) | 83 for (size_t i = 0; i < ranges->size(); ++i) |
| 84 ranges_copy.push_back(ranges->range(i)); | 84 ranges_copy.push_back(ranges->range(i)); |
| 85 HistogramBase::Sample* ranges_ptr = &ranges_copy[0]; | 85 HistogramBase::Sample* ranges_ptr = &ranges_copy[0]; |
| 86 uint32_t ranges_checksum = ranges->checksum(); | 86 uint32_t ranges_checksum = ranges->checksum(); |
| 87 uint32_t ranges_calc_checksum = ranges->CalculateChecksum(); | 87 uint32_t ranges_calc_checksum = ranges->CalculateChecksum(); |
| 88 const char* histogram_name = histogram->histogram_name().c_str(); | 88 const char* histogram_name = histogram->histogram_name(); |
| 89 int32_t flags = histogram->flags(); | 89 int32_t flags = histogram->flags(); |
| 90 // The checksum should have caught this, so crash separately if it didn't. | 90 // The checksum should have caught this, so crash separately if it didn't. |
| 91 CHECK_NE(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); | 91 CHECK_NE(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); |
| 92 CHECK(false); // Crash for the bucket order corruption. | 92 CHECK(false); // Crash for the bucket order corruption. |
| 93 // Ensure that compiler keeps around pointers to |histogram| and its | 93 // Ensure that compiler keeps around pointers to |histogram| and its |
| 94 // internal |bucket_ranges_| for any minidumps. | 94 // internal |bucket_ranges_| for any minidumps. |
| 95 base::debug::Alias(&ranges_ptr); | 95 base::debug::Alias(&ranges_ptr); |
| 96 base::debug::Alias(&ranges_checksum); | 96 base::debug::Alias(&ranges_checksum); |
| 97 base::debug::Alias(&ranges_calc_checksum); | 97 base::debug::Alias(&ranges_calc_checksum); |
| 98 base::debug::Alias(&histogram_name); | 98 base::debug::Alias(&histogram_name); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 113 return; // We've already seen this corruption for this histogram. | 113 return; // We've already seen this corruption for this histogram. |
| 114 sample_info->inconsistencies |= corruption; | 114 sample_info->inconsistencies |= corruption; |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 if (samples->TotalCount() > 0) | 118 if (samples->TotalCount() > 0) |
| 119 histogram_flattener_->RecordDelta(*histogram, *samples); | 119 histogram_flattener_->RecordDelta(*histogram, *samples); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace base | 122 } // namespace base |
| OLD | NEW |