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

Unified Diff: chrome/app/main_dll_loader_win.cc

Issue 1476193002: Revert of Crashpad Windows: Use the Crashpad client instead of Breakpad on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « chrome/app/chrome_main_delegate.cc ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/main_dll_loader_win.cc
diff --git a/chrome/app/main_dll_loader_win.cc b/chrome/app/main_dll_loader_win.cc
index 08ce84861ac55e95e16c2850eac4148299aa6fa1..ba14dba3bcc3cdb209ddf0a1ee79cb5f50530abe 100644
--- a/chrome/app/main_dll_loader_win.cc
+++ b/chrome/app/main_dll_loader_win.cc
@@ -21,7 +21,6 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
-#include "base/win/metro.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "chrome/app/chrome_crash_reporter_client.h"
@@ -40,8 +39,8 @@
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/module_util_win.h"
#include "chrome/installer/util/util_constants.h"
+#include "components/crash/content/app/breakpad_win.h"
#include "components/crash/content/app/crash_reporter_client.h"
-#include "components/crash/content/app/crashpad.h"
#include "content/public/app/sandbox_helper_win.h"
#include "content/public/common/content_switches.h"
#include "sandbox/win/src/sandbox.h"
@@ -51,6 +50,9 @@
typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*);
typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)();
+
+base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client =
+ LAZY_INSTANCE_INITIALIZER;
// Loads |module| after setting the CWD to |module|'s directory. Returns a
// reference to the loaded module on success, or null on error.
@@ -78,6 +80,11 @@
GoogleUpdateSettings::UpdateDidRunState(false, system_level);
}
+bool InMetroMode() {
+ return (wcsstr(
+ ::GetCommandLineW(), L" -ServerName:DefaultBrowserServer") != nullptr);
+}
+
typedef int (*InitMetro)();
} // namespace
@@ -85,7 +92,7 @@
//=============================================================================
MainDllLoader::MainDllLoader()
- : dll_(nullptr), metro_mode_(base::win::IsMetroProcess()) {
+ : dll_(nullptr), metro_mode_(InMetroMode()) {
}
MainDllLoader::~MainDllLoader() {
@@ -197,6 +204,18 @@
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
+ crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer());
+ bool exit_now = true;
+ if (process_type_.empty()) {
+ if (breakpad::ShowRestartDialogIfCrashed(&exit_now)) {
+ // We restarted because of a previous crash. Ask user if we should
+ // Relaunch. Only for the browser process. See crbug.com/132119.
+ if (exit_now)
+ return content::RESULT_CODE_NORMAL_EXIT;
+ }
+ }
+ breakpad::InitCrashReporter(process_type_);
+
dll_ = Load(&version, &file);
if (!dll_)
return chrome::RESULT_CODE_MISSING_DATA;
@@ -209,6 +228,12 @@
reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain"));
int rc = chrome_main(instance, &sandbox_info);
rc = OnBeforeExit(rc, file);
+ // Sandboxed processes close some system DLL handles after lockdown so ignore
+ // EXCEPTION_INVALID_HANDLE generated on Windows 10 during shutdown of these
+ // processes.
+ // TODO(wfh): Check whether MS have fixed this in Win10 RTM. crbug.com/456193
+ if (base::win::GetVersion() >= base::win::VERSION_WIN10)
+ breakpad::ConsumeInvalidHandleExceptions();
return rc;
}
@@ -250,13 +275,7 @@
RecordDidRun(dll_path);
// Launch the watcher process if stats collection consent has been granted.
-#if defined(GOOGLE_CHROME_BUILD)
- const bool stats_collection_consent =
- GoogleUpdateSettings::GetCollectStatsConsent();
-#else
- const bool stats_collection_consent = false;
-#endif
- if (stats_collection_consent) {
+ if (g_chrome_crash_client.Get().GetCollectStatsConsent()) {
base::FilePath exe_path;
if (PathService::Get(base::FILE_EXE, &exe_path)) {
chrome_watcher_client_.reset(new ChromeWatcherClient(
« no previous file with comments | « chrome/app/chrome_main_delegate.cc ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698