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

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

Issue 2622863004: Record chrome module information (Closed)
Patch Set: Address siggi's comments Created 3 years, 11 months 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
« no previous file with comments | « no previous file | components/browser_watcher/stability_data_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/prerender/prerender_field_trial.h" 22 #include "chrome/browser/prerender/prerender_field_trial.h"
23 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "components/browser_watcher/features.h" 25 #include "components/browser_watcher/features.h"
26 #include "components/browser_watcher/stability_debugging.h" 26 #include "components/browser_watcher/stability_debugging.h"
27 #include "components/variations/variations_associated_data.h" 27 #include "components/variations/variations_associated_data.h"
28 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
29 #include "media/media_features.h" 29 #include "media/media_features.h"
30 30
31 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 #include "base/win/pe_image.h"
32 #include "chrome/install_static/install_util.h" 33 #include "chrome/install_static/install_util.h"
33 #include "components/browser_watcher/stability_data_names.h" 34 #include "components/browser_watcher/stability_data_names.h"
34 #endif 35 #endif
35 36
37 #if defined(OS_WIN)
38 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
39 extern "C" IMAGE_DOS_HEADER __ImageBase;
40 #endif
41
36 namespace chrome { 42 namespace chrome {
37 43
38 namespace { 44 namespace {
39 45
40 void SetupStunProbeTrial() { 46 void SetupStunProbeTrial() {
41 #if BUILDFLAG(ENABLE_WEBRTC) 47 #if BUILDFLAG(ENABLE_WEBRTC)
42 std::map<std::string, std::string> params; 48 std::map<std::string, std::string> params;
43 if (!variations::GetVariationParams("StunProbeTrial2", &params)) 49 if (!variations::GetVariationParams("StunProbeTrial2", &params))
44 return; 50 return;
45 51
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return; 108 return;
103 } 109 }
104 LogStabilityDebuggingInitStatus(INIT_SUCCESS); 110 LogStabilityDebuggingInitStatus(INIT_SUCCESS);
105 111
106 // Track code activities (such as posting task, blocking on locks, and 112 // Track code activities (such as posting task, blocking on locks, and
107 // joining threads) that can cause hanging threads and general instability 113 // joining threads) that can cause hanging threads and general instability
108 base::debug::GlobalActivityTracker::CreateWithFile( 114 base::debug::GlobalActivityTracker::CreateWithFile(
109 stability_file, kMemorySize, kAllocatorId, 115 stability_file, kMemorySize, kAllocatorId,
110 browser_watcher::kStabilityDebuggingFeature.name, kStackDepth); 116 browser_watcher::kStabilityDebuggingFeature.name, kStackDepth);
111 117
112 // Record basic information: product, version, channel, special build and 118 // Record basic information.
113 // platform.
114 base::debug::GlobalActivityTracker* global_tracker = 119 base::debug::GlobalActivityTracker* global_tracker =
115 base::debug::GlobalActivityTracker::Get(); 120 base::debug::GlobalActivityTracker::Get();
116 if (global_tracker) { 121 if (global_tracker) {
122 // Record product, version, channel, special build and platform.
117 wchar_t exe_file[MAX_PATH] = {}; 123 wchar_t exe_file[MAX_PATH] = {};
118 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); 124 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file)));
119 125
120 base::string16 product_name; 126 base::string16 product_name;
121 base::string16 version_number; 127 base::string16 version_number;
122 base::string16 channel_name; 128 base::string16 channel_name;
123 base::string16 special_build; 129 base::string16 special_build;
124 install_static::GetExecutableVersionDetails(exe_file, &product_name, 130 install_static::GetExecutableVersionDetails(exe_file, &product_name,
125 &version_number, &special_build, 131 &version_number, &special_build,
126 &channel_name); 132 &channel_name);
127 133
128 base::debug::ActivityUserData& global_data = global_tracker->user_data(); 134 base::debug::ActivityUserData& global_data = global_tracker->user_data();
129 global_data.SetString(browser_watcher::kStabilityProduct, product_name); 135 global_data.SetString(browser_watcher::kStabilityProduct, product_name);
130 global_data.SetString(browser_watcher::kStabilityVersion, version_number); 136 global_data.SetString(browser_watcher::kStabilityVersion, version_number);
131 global_data.SetString(browser_watcher::kStabilityChannel, channel_name); 137 global_data.SetString(browser_watcher::kStabilityChannel, channel_name);
132 global_data.SetString(browser_watcher::kStabilitySpecialBuild, 138 global_data.SetString(browser_watcher::kStabilitySpecialBuild,
133 special_build); 139 special_build);
134 #if defined(ARCH_CPU_X86) 140 #if defined(ARCH_CPU_X86)
135 global_data.SetString(browser_watcher::kStabilityPlatform, "Win32"); 141 global_data.SetString(browser_watcher::kStabilityPlatform, "Win32");
136 #elif defined(ARCH_CPU_X86_64) 142 #elif defined(ARCH_CPU_X86_64)
137 global_data.SetString(browser_watcher::kStabilityPlatform, "Win64"); 143 global_data.SetString(browser_watcher::kStabilityPlatform, "Win64");
138 #endif 144 #endif
145
146 // Record information about chrome's module.
147 global_data.SetUint(browser_watcher::kStabilityModuleAddress,
148 reinterpret_cast<uint64_t>(&__ImageBase));
149
150 base::win::PEImage pe(&__ImageBase);
151 PIMAGE_NT_HEADERS headers = pe.GetNTHeaders();
152 CHECK(headers);
153 global_data.SetUint(browser_watcher::kStabilityModuleTimestamp,
154 headers->FileHeader.TimeDateStamp);
155 global_data.SetUint(browser_watcher::kStabilityModuleSize,
156 headers->OptionalHeader.SizeOfImage);
139 } 157 }
140 } 158 }
141 #endif // defined(OS_WIN) 159 #endif // defined(OS_WIN)
142 160
143 } // namespace 161 } // namespace
144 162
145 void SetupDesktopFieldTrials() { 163 void SetupDesktopFieldTrials() {
146 prerender::ConfigurePrerender(); 164 prerender::ConfigurePrerender();
147 SetupStunProbeTrial(); 165 SetupStunProbeTrial();
148 #if defined(OS_WIN) 166 #if defined(OS_WIN)
149 SetupStabilityDebugging(); 167 SetupStabilityDebugging();
150 #endif // defined(OS_WIN) 168 #endif // defined(OS_WIN)
151 // Activate the experiment as early as possible to increase its visibility 169 // Activate the experiment as early as possible to increase its visibility
152 // (e.g. the likelihood of its presence in the serialized system profile). 170 // (e.g. the likelihood of its presence in the serialized system profile).
153 // This also needs to happen before the browser rendez-vous attempt 171 // This also needs to happen before the browser rendez-vous attempt
154 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding 172 // (NotifyOtherProcessOrCreate) in PreMainMessageLoopRun so the corresponding
155 // metrics are tagged. 173 // metrics are tagged.
156 base::FeatureList::IsEnabled(features::kDesktopFastShutdown); 174 base::FeatureList::IsEnabled(features::kDesktopFastShutdown);
157 } 175 }
158 176
159 } // namespace chrome 177 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | components/browser_watcher/stability_data_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698