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

Side by Side Diff: chrome/browser/chrome_browser_field_trials.cc

Issue 1425533011: Support "shared" histograms between processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: extract common histogram FactoryGet code; extract histogram persistence into seperate files Created 5 years 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/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/metrics/histogram_base.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "components/metrics/metrics_pref_names.h" 15 #include "components/metrics/metrics_pref_names.h"
15 #include "components/omnibox/browser/omnibox_field_trial.h" 16 #include "components/omnibox/browser/omnibox_field_trial.h"
16 17
17 #if defined(OS_ANDROID) || defined(OS_IOS) 18 #if defined(OS_ANDROID) || defined(OS_IOS)
18 #include "chrome/browser/chrome_browser_field_trials_mobile.h" 19 #include "chrome/browser/chrome_browser_field_trials_mobile.h"
19 #else 20 #else
20 #include "chrome/browser/chrome_browser_field_trials_desktop.h" 21 #include "chrome/browser/chrome_browser_field_trials_desktop.h"
(...skipping 12 matching lines...) Expand all
33 InstantiateDynamicTrials(); 34 InstantiateDynamicTrials();
34 35
35 #if defined(OS_ANDROID) || defined(OS_IOS) 36 #if defined(OS_ANDROID) || defined(OS_IOS)
36 chrome::SetupMobileFieldTrials(parsed_command_line_); 37 chrome::SetupMobileFieldTrials(parsed_command_line_);
37 #else 38 #else
38 chrome::SetupDesktopFieldTrials(parsed_command_line_); 39 chrome::SetupDesktopFieldTrials(parsed_command_line_);
39 #endif 40 #endif
40 } 41 }
41 42
42 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { 43 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() {
44 // Persistent histograms must be enabled as soon as possible.
45 const std::string group_name =
46 base::FieldTrialList::FindFullName("PersistentMetrics");
47 if (base::StartsWith(
48 group_name, "Enabled", base::CompareCase::INSENSITIVE_ASCII) &&
49 !parsed_command_line_.HasSwitch(switches::kDisablePersistentMetrics)) {
Alexei Svitkine (slow) 2015/12/15 22:48:52 Please use the base/feature_list.h API instead. Th
bcwhite 2015/12/16 16:23:46 Done.
50 // Create persistent/shared memory and allow histograms to be stored in it.
51 // TODO(bcwhite): Update this with correct allocator and memory size.
52 base::HistogramBase::SetDefaultPersistentMemoryAllocator(
53 new base::LocalPersistentMemoryAllocator(1 << 20, // 1 MiB
54 0x4D5B9953, // SHA1(B..M..A..)
55 "BrowserMetricsAllocator"));
56 }
43 // The following trials are used from renderer process. 57 // The following trials are used from renderer process.
44 // Mark here so they will be sync-ed. 58 // Mark here so they will be sync-ed.
45 base::FieldTrialList::FindValue("DisplayList2dCanvas"); 59 base::FieldTrialList::FindValue("DisplayList2dCanvas");
46 // Activate the autocomplete dynamic field trials. 60 // Activate the autocomplete dynamic field trials.
47 OmniboxFieldTrial::ActivateDynamicTrials(); 61 OmniboxFieldTrial::ActivateDynamicTrials();
48 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698