summaryrefslogtreecommitdiffstats
path: root/chrome/app/main_dll_loader_win.cc
diff options
context:
space:
mode:
authorscottmg <scottmg@chromium.org>2015-11-25 13:55:47 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-25 21:57:07 +0000
commitaaa2ff656f9fcabcbdd9e9964e3b2bdc8f5102ed (patch)
tree28f1fef91043cd3f7a30c85ce59e56b057102207 /chrome/app/main_dll_loader_win.cc
parentcbc1cd295bc85219ad89326457cd7f5cf003d41c (diff)
downloadchromium_src-aaa2ff656f9fcabcbdd9e9964e3b2bdc8f5102ed.zip
chromium_src-aaa2ff656f9fcabcbdd9e9964e3b2bdc8f5102ed.tar.gz
chromium_src-aaa2ff656f9fcabcbdd9e9964e3b2bdc8f5102ed.tar.bz2
Crashpad Windows: Use the Crashpad client instead of Breakpad on Windows
Crashpad is always compiled into chrome and its handler is always enabled. It only uploads in Official builds. On Windows, the crash handler is chrome.exe run with a --crashpad-handler argument. This is due to concern about incompatibilities of shipping an additional new different binary for AV, firewalls, etc. Sample renderer crash/1aed2bc785e28995 Sample browser: crash/66c822815474a5d8 See also http://crbug.com/427611 . R=mark@chromium.org,cpu@chromium.org BUG=447073,546288, 456193 Review URL: https://codereview.chromium.org/1416133003 Cr-Commit-Position: refs/heads/master@{#361742}
Diffstat (limited to 'chrome/app/main_dll_loader_win.cc')
-rw-r--r--chrome/app/main_dll_loader_win.cc39
1 files changed, 10 insertions, 29 deletions
diff --git a/chrome/app/main_dll_loader_win.cc b/chrome/app/main_dll_loader_win.cc
index ba14dba..08ce848 100644
--- a/chrome/app/main_dll_loader_win.cc
+++ b/chrome/app/main_dll_loader_win.cc
@@ -21,6 +21,7 @@
#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"
@@ -39,8 +40,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,9 +52,6 @@ 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.
HMODULE LoadModuleWithDirectory(const base::FilePath& module, bool pre_read) {
@@ -80,11 +78,6 @@ void ClearDidRun(const base::FilePath& dll_path) {
GoogleUpdateSettings::UpdateDidRunState(false, system_level);
}
-bool InMetroMode() {
- return (wcsstr(
- ::GetCommandLineW(), L" -ServerName:DefaultBrowserServer") != nullptr);
-}
-
typedef int (*InitMetro)();
} // namespace
@@ -92,7 +85,7 @@ typedef int (*InitMetro)();
//=============================================================================
MainDllLoader::MainDllLoader()
- : dll_(nullptr), metro_mode_(InMetroMode()) {
+ : dll_(nullptr), metro_mode_(base::win::IsMetroProcess()) {
}
MainDllLoader::~MainDllLoader() {
@@ -204,18 +197,6 @@ int MainDllLoader::Launch(HINSTANCE instance) {
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;
@@ -228,12 +209,6 @@ int MainDllLoader::Launch(HINSTANCE instance) {
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;
}
@@ -275,7 +250,13 @@ void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type,
RecordDidRun(dll_path);
// Launch the watcher process if stats collection consent has been granted.
- if (g_chrome_crash_client.Get().GetCollectStatsConsent()) {
+#if defined(GOOGLE_CHROME_BUILD)
+ const bool stats_collection_consent =
+ GoogleUpdateSettings::GetCollectStatsConsent();
+#else
+ const bool stats_collection_consent = false;
+#endif
+ if (stats_collection_consent) {
base::FilePath exe_path;
if (PathService::Get(base::FILE_EXE, &exe_path)) {
chrome_watcher_client_.reset(new ChromeWatcherClient(