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

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

Issue 1780993002: Break global impact of PersistentHistogramAllocator into a separate class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-hp
Patch Set: fixed bad formatting from upstream scoped_ptr change Created 4 years, 8 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
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/persistent_histogram_allocator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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
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
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
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/persistent_histogram_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698