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

Side by Side Diff: chrome/browser/chrome_browser_field_trials.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
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 "chrome/browser/chrome_browser_field_trials.h" 5 #include "chrome/browser/chrome_browser_field_trials.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 15 matching lines...) Expand all
26 namespace { 26 namespace {
27 27
28 // Check for feature enabling the use of persistent histogram storage and 28 // Check for feature enabling the use of persistent histogram storage and
29 // create an appropriate allocator for such if so. 29 // create an appropriate allocator for such if so.
30 void InstantiatePersistentHistograms() { 30 void InstantiatePersistentHistograms() {
31 if (base::FeatureList::IsEnabled(base::kPersistentHistogramsFeature)) { 31 if (base::FeatureList::IsEnabled(base::kPersistentHistogramsFeature)) {
32 const char kAllocatorName[] = "BrowserMetrics"; 32 const char kAllocatorName[] = "BrowserMetrics";
33 // Create persistent/shared memory and allow histograms to be stored in it. 33 // Create persistent/shared memory and allow histograms to be stored in it.
34 // Memory that is not actualy used won't be physically mapped by the system. 34 // Memory that is not actualy used won't be physically mapped by the system.
35 // BrowserMetrics usage peaked around 95% of 2MiB as of 2016-02-20. 35 // BrowserMetrics usage peaked around 95% of 2MiB as of 2016-02-20.
36 base::PersistentHistogramAllocator::CreateGlobalAllocatorOnLocalMemory( 36 base::GlobalHistogramAllocator::CreateWithLocalMemory(
37 3 << 20, // 3 MiB 37 3 << 20, // 3 MiB
38 0x935DDD43, // SHA1(BrowserMetrics) 38 0x935DDD43, // SHA1(BrowserMetrics)
39 kAllocatorName); 39 kAllocatorName);
40 base::PersistentHistogramAllocator::GetGlobalAllocator() 40 base::GlobalHistogramAllocator::Get()->CreateTrackingHistograms(
41 ->CreateTrackingHistograms(kAllocatorName); 41 kAllocatorName);
42 } 42 }
43 } 43 }
44 44
45 } // namespace 45 } // namespace
46 46
47 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( 47 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials(
48 const base::CommandLine& parsed_command_line) 48 const base::CommandLine& parsed_command_line)
49 : parsed_command_line_(parsed_command_line) { 49 : parsed_command_line_(parsed_command_line) {
50 } 50 }
51 51
52 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { 52 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() {
53 } 53 }
54 54
55 void ChromeBrowserFieldTrials::SetupFieldTrials() { 55 void ChromeBrowserFieldTrials::SetupFieldTrials() {
56 // Field trials that are shared by all platforms. 56 // Field trials that are shared by all platforms.
57 InstantiateDynamicTrials(); 57 InstantiateDynamicTrials();
58 58
59 #if defined(OS_ANDROID) 59 #if defined(OS_ANDROID)
60 chrome::SetupMobileFieldTrials(parsed_command_line_); 60 chrome::SetupMobileFieldTrials(parsed_command_line_);
61 #else 61 #else
62 chrome::SetupDesktopFieldTrials(parsed_command_line_); 62 chrome::SetupDesktopFieldTrials(parsed_command_line_);
63 #endif 63 #endif
64 } 64 }
65 65
66 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { 66 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() {
67 // Persistent histograms must be enabled as soon as possible. 67 // Persistent histograms must be enabled as soon as possible.
68 InstantiatePersistentHistograms(); 68 InstantiatePersistentHistograms();
69 } 69 }
OLDNEW
« no previous file with comments | « base/metrics/statistics_recorder_unittest.cc ('k') | chrome/installer/setup/installer_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698