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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 void UninitializeStatisticsRecorder() { | 62 void UninitializeStatisticsRecorder() { |
63 delete statistics_recorder_; | 63 delete statistics_recorder_; |
64 statistics_recorder_ = NULL; | 64 statistics_recorder_ = NULL; |
65 } | 65 } |
66 | 66 |
67 void CreatePersistentHistogramAllocator() { | 67 void CreatePersistentHistogramAllocator() { |
68 // By getting the results-histogram before any persistent allocator | 68 // By getting the results-histogram before any persistent allocator |
69 // is attached, that histogram is guaranteed not to be stored in | 69 // is attached, that histogram is guaranteed not to be stored in |
70 // any persistent memory segment (which simplifies some tests). | 70 // any persistent memory segment (which simplifies some tests). |
71 PersistentHistogramAllocator::GetCreateHistogramResultHistogram(); | 71 GlobalHistogramAllocator::GetCreateHistogramResultHistogram(); |
72 | 72 |
73 PersistentHistogramAllocator::CreateGlobalAllocatorOnLocalMemory( | 73 GlobalHistogramAllocator::CreateWithLocalMemory( |
74 kAllocatorMemorySize, 0, "HistogramAllocatorTest"); | 74 kAllocatorMemorySize, 0, "HistogramAllocatorTest"); |
75 allocator_ = | 75 allocator_ = GlobalHistogramAllocator::Get()->memory_allocator(); |
76 PersistentHistogramAllocator::GetGlobalAllocator()->memory_allocator(); | |
77 } | 76 } |
78 | 77 |
79 void DestroyPersistentHistogramAllocator() { | 78 void DestroyPersistentHistogramAllocator() { |
80 allocator_ = nullptr; | 79 allocator_ = nullptr; |
81 PersistentHistogramAllocator::ReleaseGlobalAllocatorForTesting(); | 80 GlobalHistogramAllocator::ReleaseForTesting(); |
82 } | 81 } |
83 | 82 |
84 const bool use_persistent_histogram_allocator_; | 83 const bool use_persistent_histogram_allocator_; |
85 | 84 |
86 StatisticsRecorder* statistics_recorder_ = nullptr; | 85 StatisticsRecorder* statistics_recorder_ = nullptr; |
87 std::unique_ptr<char[]> allocator_memory_; | 86 std::unique_ptr<char[]> allocator_memory_; |
88 PersistentMemoryAllocator* allocator_ = nullptr; | 87 PersistentMemoryAllocator* allocator_ = nullptr; |
89 | 88 |
90 private: | 89 private: |
91 DISALLOW_COPY_AND_ASSIGN(HistogramTest); | 90 DISALLOW_COPY_AND_ASSIGN(HistogramTest); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 // CustomHistogram needs at least 1 valid range. | 702 // CustomHistogram needs at least 1 valid range. |
704 custom_ranges.clear(); | 703 custom_ranges.clear(); |
705 custom_ranges.push_back(0); | 704 custom_ranges.push_back(0); |
706 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, | 705 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges, |
707 HistogramBase::kNoFlags), | 706 HistogramBase::kNoFlags), |
708 ""); | 707 ""); |
709 } | 708 } |
710 #endif | 709 #endif |
711 | 710 |
712 } // namespace base | 711 } // namespace base |
OLD | NEW |