| 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) | 
|  | 8 #include <windows.h> | 
|  | 9 #endif | 
|  | 10 | 
| 7 #include <map> | 11 #include <map> | 
| 8 #include <string> | 12 #include <string> | 
| 9 | 13 | 
| 10 #include "base/command_line.h" | 14 #include "base/command_line.h" | 
| 11 #include "base/debug/activity_tracker.h" | 15 #include "base/debug/activity_tracker.h" | 
| 12 #include "base/feature_list.h" | 16 #include "base/feature_list.h" | 
| 13 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" | 
| 14 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" | 
| 15 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" | 
| 16 #include "base/path_service.h" | 20 #include "base/path_service.h" | 
| 17 #include "chrome/browser/features.h" | 21 #include "chrome/browser/features.h" | 
| 18 #include "chrome/browser/prerender/prerender_field_trial.h" | 22 #include "chrome/browser/prerender/prerender_field_trial.h" | 
| 19 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" | 
| 20 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" | 
| 21 #include "components/browser_watcher/features.h" | 25 #include "components/browser_watcher/features.h" | 
| 22 #include "components/variations/variations_associated_data.h" | 26 #include "components/variations/variations_associated_data.h" | 
| 23 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" | 
| 24 #include "media/media_features.h" | 28 #include "media/media_features.h" | 
| 25 | 29 | 
| 26 #if defined(OS_WIN) | 30 #if defined(OS_WIN) | 
|  | 31 #include "chrome/install_static/install_util.h" | 
|  | 32 #include "components/browser_watcher/stability_data_names.h" | 
| 27 #include "components/browser_watcher/stability_debugging_win.h" | 33 #include "components/browser_watcher/stability_debugging_win.h" | 
| 28 #endif | 34 #endif | 
| 29 | 35 | 
| 30 namespace chrome { | 36 namespace chrome { | 
| 31 | 37 | 
| 32 namespace { | 38 namespace { | 
| 33 | 39 | 
| 34 void SetupStunProbeTrial() { | 40 void SetupStunProbeTrial() { | 
| 35 #if BUILDFLAG(ENABLE_WEBRTC) | 41 #if BUILDFLAG(ENABLE_WEBRTC) | 
| 36   std::map<std::string, std::string> params; | 42   std::map<std::string, std::string> params; | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 95     LogStabilityDebuggingInitStatus(GET_STABILITY_FILE_PATH_FAILED); | 101     LogStabilityDebuggingInitStatus(GET_STABILITY_FILE_PATH_FAILED); | 
| 96     return; | 102     return; | 
| 97   } | 103   } | 
| 98   LogStabilityDebuggingInitStatus(INIT_SUCCESS); | 104   LogStabilityDebuggingInitStatus(INIT_SUCCESS); | 
| 99 | 105 | 
| 100   // Track code activities (such as posting task, blocking on locks, and | 106   // Track code activities (such as posting task, blocking on locks, and | 
| 101   // joining threads) that can cause hanging threads and general instability | 107   // joining threads) that can cause hanging threads and general instability | 
| 102   base::debug::GlobalActivityTracker::CreateWithFile( | 108   base::debug::GlobalActivityTracker::CreateWithFile( | 
| 103       stability_file, kMemorySize, kAllocatorId, | 109       stability_file, kMemorySize, kAllocatorId, | 
| 104       browser_watcher::kStabilityDebuggingFeature.name, kStackDepth); | 110       browser_watcher::kStabilityDebuggingFeature.name, kStackDepth); | 
|  | 111 | 
|  | 112   // Record basic information: product, version, channel, special build and | 
|  | 113   // platform. | 
|  | 114   base::debug::GlobalActivityTracker* global_tracker = | 
|  | 115       base::debug::GlobalActivityTracker::Get(); | 
|  | 116   if (global_tracker) { | 
|  | 117     wchar_t exe_file[MAX_PATH] = {}; | 
|  | 118     CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); | 
|  | 119 | 
|  | 120     base::string16 product_name; | 
|  | 121     base::string16 version_number; | 
|  | 122     base::string16 channel_name; | 
|  | 123     base::string16 special_build; | 
|  | 124     install_static::GetExecutableVersionDetails(exe_file, &product_name, | 
|  | 125                                                 &version_number, &special_build, | 
|  | 126                                                 &channel_name); | 
|  | 127 | 
|  | 128     base::debug::ActivityUserData& global_data = global_tracker->user_data(); | 
|  | 129     global_data.SetString(browser_watcher::kStabilityProduct, product_name); | 
|  | 130     global_data.SetString(browser_watcher::kStabilityVersion, version_number); | 
|  | 131     global_data.SetString(browser_watcher::kStabilityChannel, channel_name); | 
|  | 132     global_data.SetString(browser_watcher::kStabilitySpecialBuild, | 
|  | 133                           special_build); | 
|  | 134 #if defined(ARCH_CPU_X86) | 
|  | 135     global_data.SetString(browser_watcher::kStabilityPlatform, "Win32"); | 
|  | 136 #elif defined(ARCH_CPU_X86_64) | 
|  | 137     global_data.SetString(browser_watcher::kStabilityPlatform, "Win64"); | 
|  | 138 #endif | 
|  | 139   } | 
| 105 } | 140 } | 
| 106 #endif  // defined(OS_WIN) | 141 #endif  // defined(OS_WIN) | 
| 107 | 142 | 
| 108 }  // namespace | 143 }  // namespace | 
| 109 | 144 | 
| 110 void SetupDesktopFieldTrials() { | 145 void SetupDesktopFieldTrials() { | 
| 111   prerender::ConfigurePrerender(); | 146   prerender::ConfigurePrerender(); | 
| 112   SetupStunProbeTrial(); | 147   SetupStunProbeTrial(); | 
| 113 #if defined(OS_WIN) | 148 #if defined(OS_WIN) | 
| 114   SetupStabilityDebugging(); | 149   SetupStabilityDebugging(); | 
| 115 #endif  // defined(OS_WIN) | 150 #endif  // defined(OS_WIN) | 
| 116   // Activate the experiment as early as possible to increase its visibility | 151   // Activate the experiment as early as possible to increase its visibility | 
| 117   // (e.g. the likelihood of its presence in the serialized system profile). | 152   // (e.g. the likelihood of its presence in the serialized system profile). | 
| 118   // This also needs to happen before the browser rendez-vous attempt | 153   // This also needs to happen before the browser rendez-vous attempt | 
| 119   // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding | 154   // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding | 
| 120   // metrics are tagged. | 155   // metrics are tagged. | 
| 121   base::FeatureList::IsEnabled(features::kDesktopFastShutdown); | 156   base::FeatureList::IsEnabled(features::kDesktopFastShutdown); | 
| 122 } | 157 } | 
| 123 | 158 | 
| 124 }  // namespace chrome | 159 }  // namespace chrome | 
| OLD | NEW | 
|---|