| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_desktop.h" | 5 #include "chrome/browser/chrome_browser_field_trials_desktop.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/debug/activity_tracker.h" | 15 #include "base/debug/activity_tracker.h" |
| 16 #include "base/feature_list.h" | 16 #include "base/feature_list.h" |
| 17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 18 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
| 19 #include "base/metrics/field_trial_params.h" | 19 #include "base/metrics/field_trial_params.h" |
| 20 #include "base/metrics/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
| 21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "chrome/browser/prerender/prerender_field_trial.h" | 23 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 24 #include "chrome/common/chrome_features.h" | 24 #include "chrome/common/chrome_features.h" |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "components/browser_watcher/features.h" | 27 #include "components/browser_watcher/features.h" |
| 28 #include "components/browser_watcher/stability_paths.h" | 28 #include "components/browser_watcher/stability_paths.h" |
| 29 #include "components/metrics/persistent_system_profile.h" |
| 29 #include "components/variations/variations_associated_data.h" | 30 #include "components/variations/variations_associated_data.h" |
| 30 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
| 31 #include "media/media_features.h" | 32 #include "media/media_features.h" |
| 32 | 33 |
| 33 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 34 #include "base/win/pe_image.h" | 35 #include "base/win/pe_image.h" |
| 35 #include "chrome/install_static/install_util.h" | 36 #include "chrome/install_static/install_util.h" |
| 36 #include "components/browser_watcher/stability_data_names.h" | 37 #include "components/browser_watcher/stability_data_names.h" |
| 37 #endif | 38 #endif |
| 38 | 39 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // having a minimal amount of content in the stability file, even if | 185 // having a minimal amount of content in the stability file, even if |
| 185 // the system crashes or loses power. Note: this does not flush the file | 186 // the system crashes or loses power. Note: this does not flush the file |
| 186 // metadata nor does it wait for the changes to be flushed to disk before | 187 // metadata nor does it wait for the changes to be flushed to disk before |
| 187 // returning. This is an expensive operation. Run as an experiment to | 188 // returning. This is an expensive operation. Run as an experiment to |
| 188 // measure the effect on performance and collection. | 189 // measure the effect on performance and collection. |
| 189 const bool should_flush = base::GetFieldTrialParamByFeatureAsBool( | 190 const bool should_flush = base::GetFieldTrialParamByFeatureAsBool( |
| 190 browser_watcher::kStabilityDebuggingFeature, | 191 browser_watcher::kStabilityDebuggingFeature, |
| 191 browser_watcher::kInitFlushParam, false); | 192 browser_watcher::kInitFlushParam, false); |
| 192 if (should_flush) | 193 if (should_flush) |
| 193 ::FlushViewOfFile(global_tracker->allocator()->data(), 0U); | 194 ::FlushViewOfFile(global_tracker->allocator()->data(), 0U); |
| 195 |
| 196 // Store a copy of the system profile in this allocator. There will be some |
| 197 // delay before this gets populated, perhaps as much as a minute. Because |
| 198 // of this, there is no need to flush it here. |
| 199 metrics::GlobalPersistentSystemProfile::GetInstance() |
| 200 ->RegisterPersistentAllocator(global_tracker->allocator()); |
| 194 } | 201 } |
| 195 } | 202 } |
| 196 #endif // defined(OS_WIN) | 203 #endif // defined(OS_WIN) |
| 197 | 204 |
| 198 } // namespace | 205 } // namespace |
| 199 | 206 |
| 200 void SetupDesktopFieldTrials() { | 207 void SetupDesktopFieldTrials() { |
| 201 prerender::ConfigurePrerender(); | 208 prerender::ConfigurePrerender(); |
| 202 SetupStunProbeTrial(); | 209 SetupStunProbeTrial(); |
| 203 #if defined(OS_WIN) | 210 #if defined(OS_WIN) |
| 204 SetupStabilityDebugging(); | 211 SetupStabilityDebugging(); |
| 205 base::FeatureList::IsEnabled(features::kModuleDatabase); | 212 base::FeatureList::IsEnabled(features::kModuleDatabase); |
| 206 #endif // defined(OS_WIN) | 213 #endif // defined(OS_WIN) |
| 207 } | 214 } |
| 208 | 215 |
| 209 } // namespace chrome | 216 } // namespace chrome |
| OLD | NEW |