Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/chrome_browser_field_trials_desktop.cc

Issue 2556813002: Record executable version details to stability file (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/strings/utf_string_conversions.h"
32 #include "chrome/install_static/install_util.h"
33 #include "components/browser_watcher/stability_data_names.h"
27 #include "components/browser_watcher/stability_debugging_win.h" 34 #include "components/browser_watcher/stability_debugging_win.h"
28 #endif 35 #endif
29 36
30 namespace chrome { 37 namespace chrome {
31 38
32 namespace { 39 namespace {
33 40
34 void SetupStunProbeTrial() { 41 void SetupStunProbeTrial() {
35 #if BUILDFLAG(ENABLE_WEBRTC) 42 #if BUILDFLAG(ENABLE_WEBRTC)
36 std::map<std::string, std::string> params; 43 std::map<std::string, std::string> params;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 LogStabilityDebuggingInitStatus(GET_STABILITY_FILE_PATH_FAILED); 102 LogStabilityDebuggingInitStatus(GET_STABILITY_FILE_PATH_FAILED);
96 return; 103 return;
97 } 104 }
98 LogStabilityDebuggingInitStatus(INIT_SUCCESS); 105 LogStabilityDebuggingInitStatus(INIT_SUCCESS);
99 106
100 // Track code activities (such as posting task, blocking on locks, and 107 // Track code activities (such as posting task, blocking on locks, and
101 // joining threads) that can cause hanging threads and general instability 108 // joining threads) that can cause hanging threads and general instability
102 base::debug::GlobalActivityTracker::CreateWithFile( 109 base::debug::GlobalActivityTracker::CreateWithFile(
103 stability_file, kMemorySize, kAllocatorId, 110 stability_file, kMemorySize, kAllocatorId,
104 browser_watcher::kStabilityDebuggingFeature.name, kStackDepth); 111 browser_watcher::kStabilityDebuggingFeature.name, kStackDepth);
112
113 // Record basic information: product, version, channel, special build and
114 // platform.
115 base::debug::GlobalActivityTracker* global_tracker =
116 base::debug::GlobalActivityTracker::Get();
117 if (global_tracker) {
118 wchar_t exe_file[MAX_PATH] = {};
119 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file)));
120
121 base::string16 product_name;
122 base::string16 version_number;
123 base::string16 channel_name;
124 base::string16 special_build;
125 install_static::GetExecutableVersionDetails(exe_file, &product_name,
126 &version_number, &special_build,
127 &channel_name);
128
129 base::debug::ActivityUserData& global_data = global_tracker->user_data();
130 global_data.SetString(browser_watcher::kStabilityProduct,
bcwhite 2016/12/06 19:28:43 Feel free to create a SetString method inside Acti
manzagop (departed) 2016/12/06 21:39:02 Done.
131 base::UTF16ToUTF8(product_name));
132 global_data.SetString(browser_watcher::kStabilityVersion,
133 base::UTF16ToUTF8(version_number));
134 global_data.SetString(browser_watcher::kStabilityChannel,
135 base::UTF16ToUTF8(channel_name));
136 global_data.SetString(browser_watcher::kStabilitySpecialBuild,
137 base::UTF16ToUTF8(special_build));
138 #if defined(ARCH_CPU_X86)
139 global_data.SetString(browser_watcher::kStabilityPlatform, "Win32");
bcwhite 2016/12/06 19:28:43 Shouldn't these be x86 and x64, given that the def
manzagop (departed) 2016/12/06 21:39:03 Yeah... These are the "platform" strings that the
bcwhite 2016/12/06 22:37:32 Acknowledged.
140 #elif defined(ARCH_CPU_X86_64)
141 global_data.SetString(browser_watcher::kStabilityPlatform, "Win64");
142 #endif
143 }
105 } 144 }
106 #endif // defined(OS_WIN) 145 #endif // defined(OS_WIN)
107 146
108 } // namespace 147 } // namespace
109 148
110 void SetupDesktopFieldTrials(const base::CommandLine& parsed_command_line) { 149 void SetupDesktopFieldTrials(const base::CommandLine& parsed_command_line) {
111 prerender::ConfigurePrerender(parsed_command_line); 150 prerender::ConfigurePrerender(parsed_command_line);
112 SetupStunProbeTrial(); 151 SetupStunProbeTrial();
113 #if defined(OS_WIN) 152 #if defined(OS_WIN)
114 SetupStabilityDebugging(); 153 SetupStabilityDebugging();
115 #endif // defined(OS_WIN) 154 #endif // defined(OS_WIN)
116 // Activate the experiment as early as possible to increase its visibility 155 // Activate the experiment as early as possible to increase its visibility
117 // (e.g. the likelihood of its presence in the serialized system profile). 156 // (e.g. the likelihood of its presence in the serialized system profile).
118 // This also needs to happen before the browser rendez-vous attempt 157 // This also needs to happen before the browser rendez-vous attempt
119 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding 158 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding
120 // metrics are tagged. 159 // metrics are tagged.
121 base::FeatureList::IsEnabled(features::kDesktopFastShutdown); 160 base::FeatureList::IsEnabled(features::kDesktopFastShutdown);
122 } 161 }
123 162
124 } // namespace chrome 163 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698