Chromium Code Reviews| 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 648167695f6b70b9ca8b5c986e7c773d7d08c2ca..cc913f874073ab51febfacd1b2ee9f82e80d8287 100644 |
| --- a/chrome/browser/chrome_browser_field_trials.cc |
| +++ b/chrome/browser/chrome_browser_field_trials.cc |
| @@ -8,12 +8,15 @@ |
| #include "base/command_line.h" |
| #include "base/feature_list.h" |
| +#include "base/files/file_path.h" |
| #include "base/metrics/field_trial.h" |
| #include "base/metrics/histogram_base.h" |
| #include "base/metrics/persistent_histogram_allocator.h" |
| +#include "base/path_service.h" |
| #include "base/strings/string_util.h" |
| #include "base/time/time.h" |
| #include "build/build_config.h" |
| +#include "chrome/common/chrome_paths.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "components/metrics/metrics_pref_names.h" |
| @@ -39,6 +42,20 @@ void InstantiatePersistentHistograms() { |
| kAllocatorName); |
| base::GlobalHistogramAllocator::Get()->CreateTrackingHistograms( |
| kAllocatorName); |
| + |
| + // Set the destination for where these will be persistent. This shouldn't |
|
Ilya Sherman
2016/04/19 00:57:46
nit: s/persistent/persisted
bcwhite
2016/04/19 16:33:38
Done.
|
| + // be necessary because it's done in chrome_metrics_service_client.cc where |
| + // the reading of this file is configured but field trials don't get done |
| + // until after that point so there is no global allocator to configure |
| + // when that code runs. This won't be a problem when this (eventually) |
| + // becomes standard and is enabled during early startup. |
| + base::FilePath metrics_file; |
| + if (base::PathService::Get(chrome::DIR_USER_DATA, &metrics_file)) { |
| + metrics_file = metrics_file.AppendASCII(kAllocatorName) |
| + .AddExtension(FILE_PATH_LITERAL(".pma")); |
| + base::GlobalHistogramAllocator::Get() |
| + ->SetPersistentLocation(metrics_file); |
| + } |
|
Ilya Sherman
2016/04/19 00:57:46
I think I'd prefer to always set the location from
bcwhite
2016/04/19 16:33:38
I could add Disable/Enable methods to the GlobalHi
|
| } |
| } |