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

Unified Diff: chrome/install_static/install_util.cc

Issue 2221833005: Adding support for sampling crashes in Chrome on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rkaplow's comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/install_static/install_util.cc
diff --git a/chrome/install_static/install_util.cc b/chrome/install_static/install_util.cc
index c31b90e8927cd71f4cedf026d3b44da0f2112046..c79bcf750b0c9074ab6a3c6b879caf09e65e70dd 100644
--- a/chrome/install_static/install_util.cc
+++ b/chrome/install_static/install_util.cc
@@ -55,6 +55,9 @@ const wchar_t kAppGuidGoogleChrome[] =
const wchar_t kAppGuidGoogleBinaries[] =
L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}";
+const wchar_t kChromeMetrics[] = L"\\MetricsReporting";
+const wchar_t kChromeStatsSampleKey[] = L"UsageStatsInSample";
+
const wchar_t kHeadless[] = L"CHROME_HEADLESS";
const wchar_t kShowRestart[] = L"CHROME_CRASHED";
const wchar_t kRestartInfo[] = L"CHROME_RESTART";
@@ -271,6 +274,17 @@ bool GetCollectStatsConsentImpl(const std::wstring& exe_path) {
out_value == 1);
}
+bool GetCollectStatsInSampleImpl(const std::wstring& exe_path) {
+ std::wstring registry_path = L"Software\\";
+ registry_path += GetChromeInstallSubDirectory();
+ registry_path += kChromeMetrics;
+
+ DWORD out_value = 0;
+ return (nt::QueryRegValueDWORD(nt::HKCU, registry_path.c_str(),
+ kChromeStatsSampleKey, &out_value) &&
+ out_value == 1);
+}
+
// Returns true if the |source| string matches the |pattern|. The pattern
// may contain wildcards like '?' which matches one character or a '*'
// which matches 0 or more characters.
@@ -412,6 +426,10 @@ bool GetCollectStatsConsentForTesting(const std::wstring& exe_path) {
return GetCollectStatsConsentImpl(exe_path);
}
+bool GetCollectStatsInSample() {
+ return GetCollectStatsInSampleImpl(GetCurrentProcessExePath());
+}
+
bool ReportingIsEnforcedByPolicy(bool* metrics_is_enforced_by_policy) {
DWORD value = 0;

Powered by Google App Engine
This is Rietveld 408576698