Index: base/metrics/histogram_snapshot_manager.cc |
diff --git a/base/metrics/histogram_snapshot_manager.cc b/base/metrics/histogram_snapshot_manager.cc |
index 930fa0941efc9aab609dba80d620cdd8102e35f7..e21d512daba271dc43248a9e63b598ce98d55472 100644 |
--- a/base/metrics/histogram_snapshot_manager.cc |
+++ b/base/metrics/histogram_snapshot_manager.cc |
@@ -6,6 +6,7 @@ |
#include <memory> |
+#include "base/debug/alias.h" |
#include "base/metrics/histogram_flattener.h" |
#include "base/metrics/histogram_samples.h" |
#include "base/metrics/statistics_recorder.h" |
@@ -118,6 +119,10 @@ void HistogramSnapshotManager::PrepareSamples( |
// The checksum should have caught this, so crash separately if it didn't. |
CHECK_NE(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); |
CHECK(false); // Crash for the bucket order corruption. |
+ // Ensure that compiler keeps around pointers to |histogram| and its |
+ // internal |bucket_ranges_| for any minidumps. |
+ base::debug::Alias( |
+ static_cast<const Histogram*>(histogram)->bucket_ranges()); |
} |
// Checksum corruption might not have caused order corruption. |
CHECK_EQ(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); |