| 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.h" | 5 #include "base/metrics/histogram.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 if (allocator_) { | 49 if (allocator_) { |
| 50 ASSERT_FALSE(allocator_->IsFull()); | 50 ASSERT_FALSE(allocator_->IsFull()); |
| 51 ASSERT_FALSE(allocator_->IsCorrupt()); | 51 ASSERT_FALSE(allocator_->IsCorrupt()); |
| 52 } | 52 } |
| 53 UninitializeStatisticsRecorder(); | 53 UninitializeStatisticsRecorder(); |
| 54 DestroyPersistentHistogramAllocator(); | 54 DestroyPersistentHistogramAllocator(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void InitializeStatisticsRecorder() { | 57 void InitializeStatisticsRecorder() { |
| 58 DCHECK(!statistics_recorder_); | 58 DCHECK(!statistics_recorder_); |
| 59 statistics_recorder_.reset(new StatisticsRecorder()); | 59 statistics_recorder_ = StatisticsRecorder::CreateTemporaryForTesting(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void UninitializeStatisticsRecorder() { | 62 void UninitializeStatisticsRecorder() { |
| 63 statistics_recorder_.reset(); | 63 statistics_recorder_.reset(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void CreatePersistentHistogramAllocator() { | 66 void CreatePersistentHistogramAllocator() { |
| 67 // By getting the results-histogram before any persistent allocator | 67 // By getting the results-histogram before any persistent allocator |
| 68 // is attached, that histogram is guaranteed not to be stored in | 68 // is attached, that histogram is guaranteed not to be stored in |
| 69 // any persistent memory segment (which simplifies some tests). | 69 // any persistent memory segment (which simplifies some tests). |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 // CustomHistogram needs at least 1 valid range. | 742 // CustomHistogram needs at least 1 valid range. |
| 743 custom_ranges.clear(); | 743 custom_ranges.clear(); |
| 744 custom_ranges.push_back(0); | 744 custom_ranges.push_back(0); |
| 745 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, | 745 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, |
| 746 HistogramBase::kNoFlags), | 746 HistogramBase::kNoFlags), |
| 747 ""); | 747 ""); |
| 748 } | 748 } |
| 749 #endif | 749 #endif |
| 750 | 750 |
| 751 } // namespace base | 751 } // namespace base |
| OLD | NEW |