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 b38abad373b6044c22287436cbbee1a4db543a4c..bacc47cb9fefd7d8932a1624f593d23cf43193c8 100644 |
--- a/chrome/browser/chrome_browser_field_trials.cc |
+++ b/chrome/browser/chrome_browser_field_trials.cc |
@@ -7,7 +7,10 @@ |
#include <string> |
#include "base/command_line.h" |
+#include "base/feature_list.h" |
#include "base/metrics/field_trial.h" |
+#include "base/metrics/histogram_base.h" |
+#include "base/metrics/histogram_persistence.h" |
#include "base/strings/string_util.h" |
#include "base/time/time.h" |
#include "build/build_config.h" |
@@ -41,6 +44,18 @@ void ChromeBrowserFieldTrials::SetupFieldTrials() { |
} |
void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { |
+ // Persistent histograms must be enabled as soon as possible. |
+ if (base::FeatureList::IsEnabled(base::kPersistentHistogramsFeature)) { |
Alexei Svitkine (slow)
2016/01/14 16:43:14
You define the feature in base/ but only query it
bcwhite
2016/01/14 19:20:26
I want the same parameter to control all. I just
Alexei Svitkine (slow)
2016/01/14 21:53:41
I thought we weren't certain if we wanted the brow
bcwhite
2016/01/15 15:24:38
There's no persistence on the Browser side but mov
|
+ const std::string allocator_name("BrowserMetricsAllocator"); |
+ // Create persistent/shared memory and allow histograms to be stored in it. |
+ // TODO(bcwhite): Update this with correct allocator and memory size. |
+ base::SetPersistentHistogramMemoryAllocator( |
+ new base::LocalPersistentMemoryAllocator(1 << 20, // 1 MiB |
+ 0x4D5B9953, // SHA1(B..M..A..) |
+ allocator_name)); |
+ base::GetPersistentHistogramMemoryAllocator()->CreateHistograms( |
+ allocator_name); |
+ } |
Alexei Svitkine (slow)
2016/01/14 16:43:14
Can you move this new code to a helper function?
bcwhite
2016/01/14 19:20:26
I looked at that and it would have to be a helper
Alexei Svitkine (slow)
2016/01/18 19:25:35
Okay, please at least make it an anon function at
bcwhite
2016/01/20 15:26:14
Done.
|
// The following trials are used from renderer process. |
// Mark here so they will be sync-ed. |
base::FieldTrialList::FindValue("DisplayList2dCanvas"); |