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

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

Issue 2973863002: Remove std::string histogram name from HistogramBase object.
Patch Set: never rely on outside string permanence Created 3 years, 5 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
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 #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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (HistogramBase::BUCKET_ORDER_ERROR & corruption) { 74 if (HistogramBase::BUCKET_ORDER_ERROR & corruption) {
75 // Extract fields useful during debug. 75 // Extract fields useful during debug.
76 const BucketRanges* ranges = 76 const BucketRanges* ranges =
77 static_cast<const Histogram*>(histogram)->bucket_ranges(); 77 static_cast<const Histogram*>(histogram)->bucket_ranges();
78 std::vector<HistogramBase::Sample> ranges_copy; 78 std::vector<HistogramBase::Sample> ranges_copy;
79 for (size_t i = 0; i < ranges->size(); ++i) 79 for (size_t i = 0; i < ranges->size(); ++i)
80 ranges_copy.push_back(ranges->range(i)); 80 ranges_copy.push_back(ranges->range(i));
81 HistogramBase::Sample* ranges_ptr = &ranges_copy[0]; 81 HistogramBase::Sample* ranges_ptr = &ranges_copy[0];
82 uint32_t ranges_checksum = ranges->checksum(); 82 uint32_t ranges_checksum = ranges->checksum();
83 uint32_t ranges_calc_checksum = ranges->CalculateChecksum(); 83 uint32_t ranges_calc_checksum = ranges->CalculateChecksum();
84 const char* histogram_name = histogram->histogram_name().c_str(); 84 const char* histogram_name = histogram->histogram_name();
85 int32_t flags = histogram->flags(); 85 int32_t flags = histogram->flags();
86 // The checksum should have caught this, so crash separately if it didn't. 86 // The checksum should have caught this, so crash separately if it didn't.
87 CHECK_NE(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); 87 CHECK_NE(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption);
88 CHECK(false); // Crash for the bucket order corruption. 88 CHECK(false); // Crash for the bucket order corruption.
89 // Ensure that compiler keeps around pointers to |histogram| and its 89 // Ensure that compiler keeps around pointers to |histogram| and its
90 // internal |bucket_ranges_| for any minidumps. 90 // internal |bucket_ranges_| for any minidumps.
91 base::debug::Alias(&ranges_ptr); 91 base::debug::Alias(&ranges_ptr);
92 base::debug::Alias(&ranges_checksum); 92 base::debug::Alias(&ranges_checksum);
93 base::debug::Alias(&ranges_calc_checksum); 93 base::debug::Alias(&ranges_calc_checksum);
94 base::debug::Alias(&histogram_name); 94 base::debug::Alias(&histogram_name);
(...skipping 18 matching lines...) Expand all
113 histogram_flattener_->UniqueInconsistencyDetected( 113 histogram_flattener_->UniqueInconsistencyDetected(
114 static_cast<HistogramBase::Inconsistency>(corruption)); 114 static_cast<HistogramBase::Inconsistency>(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698