| 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 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 global_tracker->RecordModuleInfo(module); | 109 global_tracker->RecordModuleInfo(module); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void SetupStabilityDebugging() { | 112 void SetupStabilityDebugging() { |
| 113 if (!base::FeatureList::IsEnabled( | 113 if (!base::FeatureList::IsEnabled( |
| 114 browser_watcher::kStabilityDebuggingFeature)) { | 114 browser_watcher::kStabilityDebuggingFeature)) { |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 SCOPED_UMA_HISTOGRAM_TIMER("ActivityTracker.Record.SetupTime"); |
| 119 |
| 118 // TODO(bcwhite): Adjust these numbers once there is real data to show | 120 // TODO(bcwhite): Adjust these numbers once there is real data to show |
| 119 // just how much of an arena is necessary. | 121 // just how much of an arena is necessary. |
| 120 const size_t kMemorySize = 1 << 20; // 1 MiB | 122 const size_t kMemorySize = 1 << 20; // 1 MiB |
| 121 const int kStackDepth = 4; | 123 const int kStackDepth = 4; |
| 122 const uint64_t kAllocatorId = 0; | 124 const uint64_t kAllocatorId = 0; |
| 123 | 125 |
| 124 // Ensure the stability directory exists and determine the stability file's | 126 // Ensure the stability directory exists and determine the stability file's |
| 125 // path. | 127 // path. |
| 126 base::FilePath user_data_dir; | 128 base::FilePath user_data_dir; |
| 127 if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir) || | 129 if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir) || |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 global_data.SetString(browser_watcher::kStabilitySpecialBuild, | 170 global_data.SetString(browser_watcher::kStabilitySpecialBuild, |
| 169 special_build); | 171 special_build); |
| 170 #if defined(ARCH_CPU_X86) | 172 #if defined(ARCH_CPU_X86) |
| 171 global_data.SetString(browser_watcher::kStabilityPlatform, "Win32"); | 173 global_data.SetString(browser_watcher::kStabilityPlatform, "Win32"); |
| 172 #elif defined(ARCH_CPU_X86_64) | 174 #elif defined(ARCH_CPU_X86_64) |
| 173 global_data.SetString(browser_watcher::kStabilityPlatform, "Win64"); | 175 global_data.SetString(browser_watcher::kStabilityPlatform, "Win64"); |
| 174 #endif | 176 #endif |
| 175 | 177 |
| 176 // Record information about chrome's module. We want this to be done early. | 178 // Record information about chrome's module. We want this to be done early. |
| 177 RecordChromeModuleInfo(global_tracker); | 179 RecordChromeModuleInfo(global_tracker); |
| 180 |
| 181 // Trigger a flush of the memory mapped file to maximize the chances of |
| 182 // having a minimal amount of content in the stability file, even if |
| 183 // the system crashes or loses power. Note: this does not flush the file |
| 184 // metadata nor does it wait for the changes to be flushed to disk before |
| 185 // returning. This is an expensive operation. Run as an experiment to |
| 186 // measure the effect on performance and collection. |
| 187 if (base::FeatureList::IsEnabled( |
| 188 browser_watcher::kStabilityDebuggingFlushFeature)) { |
| 189 ::FlushViewOfFile(global_tracker->allocator()->data(), 0U); |
| 190 } |
| 178 } | 191 } |
| 179 } | 192 } |
| 180 #endif // defined(OS_WIN) | 193 #endif // defined(OS_WIN) |
| 181 | 194 |
| 182 } // namespace | 195 } // namespace |
| 183 | 196 |
| 184 void SetupDesktopFieldTrials() { | 197 void SetupDesktopFieldTrials() { |
| 185 prerender::ConfigurePrerender(); | 198 prerender::ConfigurePrerender(); |
| 186 SetupStunProbeTrial(); | 199 SetupStunProbeTrial(); |
| 187 #if defined(OS_WIN) | 200 #if defined(OS_WIN) |
| 188 SetupStabilityDebugging(); | 201 SetupStabilityDebugging(); |
| 189 base::FeatureList::IsEnabled(features::kModuleDatabase); | 202 base::FeatureList::IsEnabled(features::kModuleDatabase); |
| 190 #endif // defined(OS_WIN) | 203 #endif // defined(OS_WIN) |
| 191 // Activate the experiment as early as possible to increase its visibility | 204 // Activate the experiment as early as possible to increase its visibility |
| 192 // (e.g. the likelihood of its presence in the serialized system profile). | 205 // (e.g. the likelihood of its presence in the serialized system profile). |
| 193 // This also needs to happen before the browser rendez-vous attempt | 206 // This also needs to happen before the browser rendez-vous attempt |
| 194 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding | 207 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding |
| 195 // metrics are tagged. | 208 // metrics are tagged. |
| 196 base::FeatureList::IsEnabled(features::kDesktopFastShutdown); | 209 base::FeatureList::IsEnabled(features::kDesktopFastShutdown); |
| 197 } | 210 } |
| 198 | 211 |
| 199 } // namespace chrome | 212 } // namespace chrome |
| OLD | NEW |