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

Unified Diff: chrome/browser/chrome_browser_field_trials.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
Index: chrome/browser/chrome_browser_field_trials.cc
diff --git a/chrome/browser/chrome_browser_field_trials.cc b/chrome/browser/chrome_browser_field_trials.cc
index a839e144222bd171dda462a3f4fb5ba9f7c73f58..727ece58157ff476aecfdb4f5aa446ecd6737875 100644
--- a/chrome/browser/chrome_browser_field_trials.cc
+++ b/chrome/browser/chrome_browser_field_trials.cc
@@ -14,6 +14,7 @@
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "build/build_config.h"
+#include "chrome/browser/metrics/chrome_metrics_service_client.h"
#include "chrome/common/chrome_switches.h"
#include "components/metrics/metrics_pref_names.h"
@@ -29,11 +30,18 @@ namespace {
// enable the global allocator if so.
void InstantiatePersistentHistograms() {
if (base::FeatureList::IsEnabled(base::kPersistentHistogramsFeature)) {
- base::GlobalHistogramAllocator::Enable();
+ // Create persistent/shared memory and allow histograms to be stored in
+ // it. Memory that is not actualy used won't be physically mapped by the
+ // system. BrowserMetrics usage, as reported in UMA, peaked around 1.9MiB
+ // as of 2016-02-20.
+ base::GlobalHistogramAllocator::CreateWithLocalMemory(
+ 3 << 20, // 3 MiB
+ 0x935DDD43, // SHA1(BrowserMetrics)
+ ChromeMetricsServiceClient::kBrowserMetricsName);
base::GlobalHistogramAllocator* allocator =
base::GlobalHistogramAllocator::Get();
- DCHECK(allocator); // Should have been created during startup.
- allocator->CreateTrackingHistograms(allocator->Name());
+ allocator->CreateTrackingHistograms(
+ ChromeMetricsServiceClient::kBrowserMetricsName);
}
}
« no previous file with comments | « base/metrics/persistent_histogram_allocator.cc ('k') | chrome/browser/metrics/chrome_metrics_service_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698