| 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/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 21 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 22 #include "chrome/browser/features.h" | 23 #include "chrome/browser/features.h" |
| 23 #include "chrome/browser/prerender/prerender_field_trial.h" | 24 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 24 #include "chrome/common/chrome_features.h" | 25 #include "chrome/common/chrome_features.h" |
| 25 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 27 #include "components/browser_watcher/features.h" | 28 #include "components/browser_watcher/features.h" |
| 28 #include "components/browser_watcher/stability_debugging.h" | 29 #include "components/browser_watcher/stability_debugging.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 181 |
| 181 // Record information about chrome's module. We want this to be done early. | 182 // Record information about chrome's module. We want this to be done early. |
| 182 RecordChromeModuleInfo(global_tracker); | 183 RecordChromeModuleInfo(global_tracker); |
| 183 | 184 |
| 184 // Trigger a flush of the memory mapped file to maximize the chances of | 185 // Trigger a flush of the memory mapped file to maximize the chances of |
| 185 // having a minimal amount of content in the stability file, even if | 186 // having a minimal amount of content in the stability file, even if |
| 186 // the system crashes or loses power. Note: this does not flush the file | 187 // the system crashes or loses power. Note: this does not flush the file |
| 187 // metadata nor does it wait for the changes to be flushed to disk before | 188 // metadata nor does it wait for the changes to be flushed to disk before |
| 188 // returning. This is an expensive operation. Run as an experiment to | 189 // returning. This is an expensive operation. Run as an experiment to |
| 189 // measure the effect on performance and collection. | 190 // measure the effect on performance and collection. |
| 190 if (base::FeatureList::IsEnabled( | 191 const bool should_flush = base::GetFieldTrialParamByFeatureAsBool( |
| 191 browser_watcher::kStabilityDebuggingFlushFeature)) { | 192 browser_watcher::kStabilityDebuggingFeature, |
| 193 browser_watcher::kInitFlushParam, false); |
| 194 if (should_flush) |
| 192 ::FlushViewOfFile(global_tracker->allocator()->data(), 0U); | 195 ::FlushViewOfFile(global_tracker->allocator()->data(), 0U); |
| 193 } | |
| 194 } | 196 } |
| 195 } | 197 } |
| 196 #endif // defined(OS_WIN) | 198 #endif // defined(OS_WIN) |
| 197 | 199 |
| 198 } // namespace | 200 } // namespace |
| 199 | 201 |
| 200 void SetupDesktopFieldTrials() { | 202 void SetupDesktopFieldTrials() { |
| 201 prerender::ConfigurePrerender(); | 203 prerender::ConfigurePrerender(); |
| 202 SetupStunProbeTrial(); | 204 SetupStunProbeTrial(); |
| 203 #if defined(OS_WIN) | 205 #if defined(OS_WIN) |
| 204 SetupStabilityDebugging(); | 206 SetupStabilityDebugging(); |
| 205 base::FeatureList::IsEnabled(features::kModuleDatabase); | 207 base::FeatureList::IsEnabled(features::kModuleDatabase); |
| 206 #endif // defined(OS_WIN) | 208 #endif // defined(OS_WIN) |
| 207 // Activate the experiment as early as possible to increase its visibility | 209 // Activate the experiment as early as possible to increase its visibility |
| 208 // (e.g. the likelihood of its presence in the serialized system profile). | 210 // (e.g. the likelihood of its presence in the serialized system profile). |
| 209 // This also needs to happen before the browser rendez-vous attempt | 211 // This also needs to happen before the browser rendez-vous attempt |
| 210 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding | 212 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding |
| 211 // metrics are tagged. | 213 // metrics are tagged. |
| 212 base::FeatureList::IsEnabled(features::kDesktopFastShutdown); | 214 base::FeatureList::IsEnabled(features::kDesktopFastShutdown); |
| 213 } | 215 } |
| 214 | 216 |
| 215 } // namespace chrome | 217 } // namespace chrome |
| OLD | NEW |