Chromium Code Reviews| 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" |
| 22 #include "base/strings/string_util.h" | |
| 21 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 22 #include "chrome/browser/features.h" | 24 #include "chrome/browser/features.h" |
| 23 #include "chrome/browser/prerender/prerender_field_trial.h" | 25 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 24 #include "chrome/common/chrome_features.h" | 26 #include "chrome/common/chrome_features.h" |
| 25 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 27 #include "components/browser_watcher/features.h" | 29 #include "components/browser_watcher/features.h" |
| 28 #include "components/browser_watcher/stability_debugging.h" | 30 #include "components/browser_watcher/stability_debugging.h" |
| 29 #include "components/variations/variations_associated_data.h" | 31 #include "components/variations/variations_associated_data.h" |
| 30 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 | 182 |
| 181 // Record information about chrome's module. We want this to be done early. | 183 // Record information about chrome's module. We want this to be done early. |
| 182 RecordChromeModuleInfo(global_tracker); | 184 RecordChromeModuleInfo(global_tracker); |
| 183 | 185 |
| 184 // Trigger a flush of the memory mapped file to maximize the chances of | 186 // 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 | 187 // 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 | 188 // 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 | 189 // 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 | 190 // returning. This is an expensive operation. Run as an experiment to |
| 189 // measure the effect on performance and collection. | 191 // measure the effect on performance and collection. |
| 190 if (base::FeatureList::IsEnabled( | 192 const std::string init_flush_param = base::GetFieldTrialParamValueByFeature( |
|
rkaplow
2017/03/13 15:38:00
using GetFieldTrialParamByFeatureAsBool will make
manzagop (departed)
2017/03/13 17:51:26
Done.
| |
| 191 browser_watcher::kStabilityDebuggingFlushFeature)) { | 193 browser_watcher::kStabilityDebuggingFeature, |
| 194 browser_watcher::kInitFlushParam); | |
| 195 if (base::LowerCaseEqualsASCII(init_flush_param, "true")) { | |
| 192 ::FlushViewOfFile(global_tracker->allocator()->data(), 0U); | 196 ::FlushViewOfFile(global_tracker->allocator()->data(), 0U); |
| 193 } | 197 } |
| 194 } | 198 } |
| 195 } | 199 } |
| 196 #endif // defined(OS_WIN) | 200 #endif // defined(OS_WIN) |
| 197 | 201 |
| 198 } // namespace | 202 } // namespace |
| 199 | 203 |
| 200 void SetupDesktopFieldTrials() { | 204 void SetupDesktopFieldTrials() { |
| 201 prerender::ConfigurePrerender(); | 205 prerender::ConfigurePrerender(); |
| 202 SetupStunProbeTrial(); | 206 SetupStunProbeTrial(); |
| 203 #if defined(OS_WIN) | 207 #if defined(OS_WIN) |
| 204 SetupStabilityDebugging(); | 208 SetupStabilityDebugging(); |
| 205 base::FeatureList::IsEnabled(features::kModuleDatabase); | 209 base::FeatureList::IsEnabled(features::kModuleDatabase); |
| 206 #endif // defined(OS_WIN) | 210 #endif // defined(OS_WIN) |
| 207 // Activate the experiment as early as possible to increase its visibility | 211 // Activate the experiment as early as possible to increase its visibility |
| 208 // (e.g. the likelihood of its presence in the serialized system profile). | 212 // (e.g. the likelihood of its presence in the serialized system profile). |
| 209 // This also needs to happen before the browser rendez-vous attempt | 213 // This also needs to happen before the browser rendez-vous attempt |
| 210 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding | 214 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding |
| 211 // metrics are tagged. | 215 // metrics are tagged. |
| 212 base::FeatureList::IsEnabled(features::kDesktopFastShutdown); | 216 base::FeatureList::IsEnabled(features::kDesktopFastShutdown); |
| 213 } | 217 } |
| 214 | 218 |
| 215 } // namespace chrome | 219 } // namespace chrome |
| OLD | NEW |