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

Unified Diff: base/metrics/persistent_histogram_allocator.cc

Issue 1996843002: Delay PersistentHistogramAllocator creation until it's known to be used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comments by Alexei Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/persistent_histogram_allocator.h ('k') | chrome/browser/chrome_browser_field_trials.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/persistent_histogram_allocator.cc
diff --git a/base/metrics/persistent_histogram_allocator.cc b/base/metrics/persistent_histogram_allocator.cc
index 2a090366a8b4d90dde75b2c9621c2aaf94f6f885..20f64336016ae7acf269c3faa25ba3e8fc585425 100644
--- a/base/metrics/persistent_histogram_allocator.cc
+++ b/base/metrics/persistent_histogram_allocator.cc
@@ -47,7 +47,6 @@ enum : uint32_t {
// anything essential at exit anyway due to the fact that they depend on data
// managed elsewhere and which could be destructed first.
GlobalHistogramAllocator* g_allocator = nullptr;
-bool g_allocator_enabled = false;
// Take an array of range boundaries and create a proper BucketRanges object
// which is returned to the caller. A return of nullptr indicates that the
@@ -657,18 +656,6 @@ void GlobalHistogramAllocator::CreateWithSharedMemoryHandle(
}
// static
-void GlobalHistogramAllocator::Enable() {
- DCHECK(g_allocator);
- g_allocator_enabled = true;
-}
-
-// static
-void GlobalHistogramAllocator::Disable() {
- DCHECK(g_allocator);
- g_allocator_enabled = false;
-}
-
-// static
void GlobalHistogramAllocator::Set(
std::unique_ptr<GlobalHistogramAllocator> allocator) {
// Releasing or changing an allocator is extremely dangerous because it
@@ -676,7 +663,6 @@ void GlobalHistogramAllocator::Set(
// also released, future accesses to those histograms will seg-fault.
CHECK(!g_allocator);
g_allocator = allocator.release();
- g_allocator_enabled = true;
size_t existing = StatisticsRecorder::GetHistogramCount();
DVLOG_IF(1, existing)
@@ -685,11 +671,6 @@ void GlobalHistogramAllocator::Set(
// static
GlobalHistogramAllocator* GlobalHistogramAllocator::Get() {
- return g_allocator_enabled ? g_allocator : nullptr;
-}
-
-// static
-GlobalHistogramAllocator* GlobalHistogramAllocator::GetEvenIfDisabled() {
return g_allocator;
}
@@ -733,8 +714,6 @@ void GlobalHistogramAllocator::SetPersistentLocation(const FilePath& location) {
}
bool GlobalHistogramAllocator::WriteToPersistentLocation() {
- DCHECK(g_allocator_enabled);
-
#if defined(OS_NACL)
// NACL doesn't support file operations, including ImportantFileWriter.
NOTREACHED();
« no previous file with comments | « base/metrics/persistent_histogram_allocator.h ('k') | chrome/browser/chrome_browser_field_trials.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698