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

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 2033173002: Moving Breakpad Windows specific logic to lower layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows test. Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_accessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index 8c6adaebb8fdeafad4431f446d61f7cfd0e5d644..729d04ede88ce1891ad678b563548235fe225efa 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -6,6 +6,10 @@
#include <memory>
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
#include "base/bind.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
@@ -47,6 +51,8 @@
#if defined(OS_WIN)
#include "base/win/win_util.h"
+#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
+#include "chrome/common/chrome_constants.h"
#endif
namespace chrome {
@@ -188,6 +194,23 @@ void AttemptUserExit() {
// The Android implementation is in application_lifetime_android.cc
#if !defined(OS_ANDROID)
void AttemptRestart() {
+#if defined(OS_WIN)
+ // On Windows Breakpad will upload crash reports if the breakpad pipe name
Lei Zhang 2016/06/06 22:56:15 there's a missing comma after "Windows"
dpapad 2016/06/06 23:14:37 Done.
+ // environment variable is defined. So we undefine this environment variable
+ // before restarting, as the restarted processes will inherit their
+ // environment variables from ours, thus suppressing crash uploads.
+ if (!ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()) {
+ HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
+ if (exe_module) {
+ typedef void (__cdecl *ClearBreakpadPipeEnvVar)();
Sigurður Ásgeirsson 2016/06/06 13:40:01 these in-place function type declarations irk me.
dpapad 2016/06/06 17:09:45 I prefer to leave this cleanup to someone with a W
+ ClearBreakpadPipeEnvVar clear = reinterpret_cast<ClearBreakpadPipeEnvVar>(
+ GetProcAddress(exe_module, "ClearBreakpadPipeEnvironmentVariable"));
+ if (clear)
+ clear();
+ }
+ }
+#endif // defined(OS_WIN)
+
// TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead?
for (auto* browser : *BrowserList::GetInstance())
content::BrowserContext::SaveSessionState(browser->profile());
@@ -210,7 +233,7 @@ void AttemptRestart() {
AttemptExit();
#endif
}
-#endif
+#endif // !defined(OS_ANDROID)
void AttemptExit() {
#if defined(OS_CHROMEOS)
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_accessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698