diff options
author | scottmg <scottmg@chromium.org> | 2015-12-02 11:20:12 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-02 19:22:11 +0000 |
commit | 8cafdc1d0e5f922d1c1cb7f24b827de82c2fffe9 (patch) | |
tree | f50c47399ae9f5770b19c9c5cab710e05135d2e4 | |
parent | 38aa9811fec66706f122aeeb29590a57deb0fcd0 (diff) | |
download | chromium_src-8cafdc1d0e5f922d1c1cb7f24b827de82c2fffe9.zip chromium_src-8cafdc1d0e5f922d1c1cb7f24b827de82c2fffe9.tar.gz chromium_src-8cafdc1d0e5f922d1c1cb7f24b827de82c2fffe9.tar.bz2 |
win: Build fix for syzyasan/kasko build after switch to crashpad
One part simple compile fix to get a CrashReporterClient. This will be
removed after Crashpad moves back to the .exe (soon) here:
https://codereview.chromium.org/1481703002/
The other part is that Kasko pokes into Breakpad to get the crash keys,
but we of course don't have breakpad any more. For now, initialize the
breakpad crash keys when we're using Kasko. This will need to be tidied
up.
R=chrisha@chromium.org
BUG=564329, 546288
Review URL: https://codereview.chromium.org/1491053002
Cr-Commit-Position: refs/heads/master@{#362768}
-rw-r--r-- | chrome/app/main_dll_loader_win.cc | 54 | ||||
-rw-r--r-- | chrome/chrome_exe.gypi | 3 |
2 files changed, 53 insertions, 4 deletions
diff --git a/chrome/app/main_dll_loader_win.cc b/chrome/app/main_dll_loader_win.cc index a6036e8..fe64b1d 100644 --- a/chrome/app/main_dll_loader_win.cc +++ b/chrome/app/main_dll_loader_win.cc @@ -4,6 +4,7 @@ #include <windows.h> // NOLINT #include <shlwapi.h> // NOLINT +#include <userenv.h> // NOLINT #include "chrome/app/main_dll_loader_win.h" @@ -42,6 +43,7 @@ #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/crash_keys_win.h" #include "components/crash/content/app/crash_reporter_client.h" #include "components/crash/content/app/crashpad.h" #include "components/startup_metric_utils/browser/pre_read_field_trial_utils_win.h" @@ -100,6 +102,39 @@ void ClearDidRun(const base::FilePath& dll_path) { typedef int (*InitMetro)(); +#if defined(KASKO) + +// Returns a string containing a list of all modifiers for the loaded profile. +std::wstring GetProfileType() { + std::wstring profile_type; + DWORD profile_bits = 0; + if (::GetProfileType(&profile_bits)) { + static const struct { + DWORD bit; + const wchar_t* name; + } kBitNames[] = { + { PT_MANDATORY, L"mandatory" }, + { PT_ROAMING, L"roaming" }, + { PT_TEMPORARY, L"temporary" }, + }; + for (size_t i = 0; i < arraysize(kBitNames); ++i) { + const DWORD this_bit = kBitNames[i].bit; + if ((profile_bits & this_bit) != 0) { + profile_type.append(kBitNames[i].name); + profile_bits &= ~this_bit; + if (profile_bits != 0) + profile_type.append(L", "); + } + } + } else { + DWORD last_error = ::GetLastError(); + base::SStringPrintf(&profile_type, L"error %u", last_error); + } + return profile_type; +} + +#endif // KASKO + } // namespace //============================================================================= @@ -288,13 +323,24 @@ void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type, switches::kFullMemoryCrashReport)) { minidump_type = kasko::api::FULL_DUMP_TYPE; } else { - bool is_per_user_install = - g_chrome_crash_client.Get().GetIsPerUserInstall( - base::FilePath(exe_path)); - if (g_chrome_crash_client.Get().GetShouldDumpLargerDumps( + // TODO(scottmg): Point this at the common global one when it's + // moved back into the .exe. http://crbug.com/546288. + ChromeCrashReporterClient chrome_crash_client; + bool is_per_user_install = chrome_crash_client.GetIsPerUserInstall( + base::FilePath(exe_path)); + if (chrome_crash_client.GetShouldDumpLargerDumps( is_per_user_install)) { minidump_type = kasko::api::LARGER_DUMP_TYPE; } + + // TODO(scottmg): http://crbug.com/564329 Breakpad is no longer + // initialized. For now, initialize the CustomInfoEntries here so + // Kasko can pull them out. + static breakpad::CrashKeysWin crash_keys_win; + crash_keys_win.GetCustomInfo( + exe_path.value(), base::UTF8ToUTF16(process_type), + GetProfileType(), base::CommandLine::ForCurrentProcess(), + &chrome_crash_client); } kasko_client_.reset( diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index 27bd63e..4527469 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi @@ -112,6 +112,9 @@ 'dependencies': [ 'kasko_dll', ], + 'sources': [ + 'app/chrome_crash_reporter_client.cc', + ], }], ['win_console_app==1', { 'defines': ['WIN_CONSOLE_APP'], |