| diff --git chrome/chrome_elf/BUILD.gn chrome/chrome_elf/BUILD.gn |
| index 9b08e23e921b..49182504ae36 100644 |
| --- chrome/chrome_elf/BUILD.gn |
| +++ chrome/chrome_elf/BUILD.gn |
| @@ -7,6 +7,7 @@ |
| |
| import("//build/config/compiler/compiler.gni") |
| import("//build/config/win/manifest.gni") |
| +import("//cef/libcef/features/features.gni") |
| import("//chrome/process_version_rc_template.gni") |
| import("//testing/test.gni") |
| |
| @@ -104,9 +105,6 @@ source_set("constants") { |
| |
| static_library("crash") { |
| sources = [ |
| - "../app/chrome_crash_reporter_client_win.cc", |
| - "../app/chrome_crash_reporter_client_win.h", |
| - "../common/chrome_result_codes.h", |
| "crash/crash_helper.cc", |
| "crash/crash_helper.h", |
| ] |
| @@ -114,6 +112,7 @@ static_library("crash") { |
| ":hook_util", |
| "//base", # This needs to go. DEP of app, crash_keys, client. |
| "//base:base_static", # pe_image |
| + "//cef/libcef/features", |
| "//chrome/install_static:install_static_util", |
| "//components/crash/core/app", |
| "//components/crash/core/common", # crash_keys |
| @@ -121,6 +120,17 @@ static_library("crash") { |
| "//content/public/common:result_codes", |
| "//third_party/crashpad/crashpad/client", # DumpWithoutCrash |
| ] |
| + |
| + if (enable_cef) { |
| + deps += [ "//cef:chrome_elf_set" ] |
| + include_dirs = [ "//cef" ] |
| + } else { |
| + sources += [ |
| + "//chrome/app/chrome_crash_reporter_client_win.cc", |
| + "//chrome/app/chrome_crash_reporter_client_win.h", |
| + "//chrome/common/chrome_result_codes.h", |
| + ] |
| + } |
| } |
| |
| source_set("dll_hash") { |
| diff --git chrome/chrome_elf/crash/crash_helper.cc chrome/chrome_elf/crash/crash_helper.cc |
| index 42a4bfcdb856..9f674625a155 100644 |
| --- chrome/chrome_elf/crash/crash_helper.cc |
| +++ chrome/chrome_elf/crash/crash_helper.cc |
| @@ -11,12 +11,17 @@ |
| #include <string> |
| #include <vector> |
| |
| +#include "cef/libcef/features/features.h" |
| #include "chrome/app/chrome_crash_reporter_client_win.h" |
| #include "chrome/chrome_elf/hook_util/hook_util.h" |
| #include "components/crash/core/app/crashpad.h" |
| #include "components/crash/core/common/crash_keys.h" |
| #include "third_party/crashpad/crashpad/client/crashpad_client.h" |
| |
| +#if BUILDFLAG(ENABLE_CEF) |
| +#include "cef/libcef/common/crash_reporter_client.h" |
| +#endif |
| + |
| namespace { |
| |
| // Crash handling from elf is only enabled for the chrome.exe process. |
| @@ -77,7 +82,11 @@ bool InitializeCrashReporting() { |
| g_crash_reports = new std::vector<crash_reporter::Report>; |
| g_set_unhandled_exception_filter = new elf_hook::IATHook(); |
| |
| +#if BUILDFLAG(ENABLE_CEF) |
| + CefCrashReporterClient::InitializeCrashReportingForProcess(); |
| +#else |
| ChromeCrashReporterClient::InitializeCrashReportingForProcess(); |
| +#endif |
| |
| g_crash_helper_enabled = true; |
| return true; |
| diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc |
| index f9a6c6b6ae2d..3701b4423899 100644 |
| --- chrome/common/crash_keys.cc |
| +++ chrome/common/crash_keys.cc |
| @@ -4,6 +4,8 @@ |
| |
| #include "chrome/common/crash_keys.h" |
| |
| +#include <iterator> |
| + |
| #include "base/base_switches.h" |
| #include "base/command_line.h" |
| #include "base/logging.h" |
| @@ -28,7 +30,7 @@ |
| namespace crash_keys { |
| |
| // Return true if we DON'T want to upload this flag to the crash server. |
| -static bool IsBoringSwitch(const std::string& flag) { |
| +bool IsBoringChromeSwitch(const std::string& flag) { |
| static const char* const kIgnoreSwitches[] = { |
| switches::kEnableLogging, |
| switches::kFlagSwitchesBegin, |
| @@ -83,7 +85,7 @@ static bool IsBoringSwitch(const std::string& flag) { |
| } |
| |
| void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { |
| - return SetSwitchesFromCommandLine(command_line, &IsBoringSwitch); |
| + return SetSwitchesFromCommandLine(command_line, &IsBoringChromeSwitch); |
| } |
| |
| void SetActiveExtensions(const std::set<std::string>& extensions) { |
| diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h |
| index bcf172e645a2..f879aa745adf 100644 |
| --- chrome/common/crash_keys.h |
| +++ chrome/common/crash_keys.h |
| @@ -17,6 +17,10 @@ class CommandLine; |
| |
| namespace crash_keys { |
| |
| +// Returns true if the specified command-line flag should be excluded from |
| +// crash reporting. |
| +bool IsBoringChromeSwitch(const std::string& flag); |
| + |
| // Sets the kNumSwitches key and the set of keys named using kSwitchFormat based |
| // on the given |command_line|. |
| void SetCrashKeysFromCommandLine(const base::CommandLine& command_line); |
| diff --git components/crash/core/app/breakpad_linux.cc components/crash/core/app/breakpad_linux.cc |
| index 192b0a7f137f..d53b90173ae2 100644 |
| --- components/crash/core/app/breakpad_linux.cc |
| +++ components/crash/core/app/breakpad_linux.cc |
| @@ -28,6 +28,7 @@ |
| #include "base/base_switches.h" |
| #include "base/command_line.h" |
| #include "base/debug/dump_without_crashing.h" |
| +#include "base/debug/leak_annotations.h" |
| #include "base/files/file_path.h" |
| #include "base/lazy_instance.h" |
| #include "base/linux_util.h" |
| @@ -104,6 +105,7 @@ namespace { |
| uint64_t g_crash_loop_before_time = 0; |
| #else |
| const char kUploadURL[] = "https://clients2.google.com/cr/report"; |
| +const char* g_crash_server_url = kUploadURL; |
| #endif |
| |
| bool g_is_crash_reporter_enabled = false; |
| @@ -717,7 +719,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, |
| info.process_type_length = 7; |
| info.distro = base::g_linux_distro; |
| info.distro_length = my_strlen(base::g_linux_distro); |
| - info.upload = upload; |
| + info.upload = upload && g_crash_server_url; |
| info.process_start_time = g_process_start_time; |
| info.oom_size = base::g_oom_size; |
| info.pid = g_pid; |
| @@ -1404,7 +1406,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, |
| header_content_encoding, |
| header_content_type, |
| post_file, |
| - kUploadURL, |
| + g_crash_server_url, |
| "--timeout=10", // Set a timeout so we don't hang forever. |
| "--tries=1", // Don't retry if the upload fails. |
| "-O", // Output reply to the file descriptor path. |
| @@ -1744,10 +1746,19 @@ void HandleCrashDump(const BreakpadInfo& info) { |
| GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version); |
| |
| writer.AddBoundary(); |
| - writer.AddPairString("prod", product_name); |
| + writer.AddPairString("product", product_name); |
| + writer.AddBoundary(); |
| + writer.AddPairString("version", version); |
| writer.AddBoundary(); |
| - writer.AddPairString("ver", version); |
| + |
| +#if defined(ARCH_CPU_32_BITS) |
| + const char* platform = "linux32"; |
| +#elif defined(ARCH_CPU_64_BITS) |
| + const char* platform = "linux64"; |
| +#endif |
| + writer.AddPairString("platform", platform); |
| writer.AddBoundary(); |
| + |
| if (info.pid > 0) { |
| char pid_value_buf[kUint64StringSize]; |
| uint64_t pid_value_len = my_uint64_len(info.pid); |
| @@ -1864,6 +1875,9 @@ void HandleCrashDump(const BreakpadInfo& info) { |
| crash_reporter::internal::TransitionalCrashKeyStorage; |
| CrashKeyStorage::Iterator crash_key_iterator(*info.crash_keys); |
| const CrashKeyStorage::Entry* entry; |
| + |
| + crash_reporter::CrashReporterClient::ParameterMap parameters; |
| + |
| while ((entry = crash_key_iterator.Next())) { |
| if (g_use_crash_key_white_list && !IsInWhiteList(entry->key)) |
| continue; |
| @@ -1876,7 +1890,13 @@ void HandleCrashDump(const BreakpadInfo& info) { |
| ? CrashKeyStorage::value_size - 1 |
| : my_strlen(entry->value); |
| |
| - writer.AddPairData(entry->key, key_size, entry->value, value_size); |
| + parameters.insert(std::make_pair(std::string{entry->key, key_size}, std::string{entry->value, value_size})); |
| + } |
| + if (!parameters.empty()) |
| + parameters = GetCrashReporterClient()->FilterParameters(parameters); |
| + |
| + for (const auto& param : parameters) { |
| + writer.AddPairData(param.first.data(), param.first.size(), param.second.data(), param.second.size()); |
| writer.AddBoundary(); |
| writer.Flush(); |
| } |
| @@ -2088,6 +2108,17 @@ void SetChannelCrashKey(const std::string& channel) { |
| channel_key.Set(channel); |
| } |
| |
| +void SetCrashServerURL(const std::string& url) { |
| + if (url.empty()) { |
| + g_crash_server_url = nullptr; |
| + } else { |
| + char* new_url = new char[url.size() + 1]; |
| + ANNOTATE_LEAKING_OBJECT_PTR(new_url); |
| + strcpy(new_url, url.c_str()); |
| + g_crash_server_url = new_url; |
| + } |
| +} |
| + |
| #if defined(OS_ANDROID) |
| void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) { |
| SanitizationInfo sanitization_info; |
| diff --git components/crash/core/app/breakpad_linux.h components/crash/core/app/breakpad_linux.h |
| index 9ea80370a842..3043f7d32f33 100644 |
| --- components/crash/core/app/breakpad_linux.h |
| +++ components/crash/core/app/breakpad_linux.h |
| @@ -20,6 +20,9 @@ extern void InitCrashReporter(const std::string& process_type); |
| // Sets the product/distribution channel crash key. |
| void SetChannelCrashKey(const std::string& channel); |
| |
| +// Set the crash server URL. |
| +void SetCrashServerURL(const std::string& url); |
| + |
| #if defined(OS_ANDROID) |
| extern void InitCrashKeysForTesting(); |
| |
| diff --git components/crash/core/app/crash_reporter_client.cc components/crash/core/app/crash_reporter_client.cc |
| index e778f68af30f..d2a2a6bf1f67 100644 |
| --- components/crash/core/app/crash_reporter_client.cc |
| +++ components/crash/core/app/crash_reporter_client.cc |
| @@ -88,7 +88,7 @@ int CrashReporterClient::GetResultCodeRespawnFailed() { |
| } |
| #endif |
| |
| -#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) |
| +#if defined(OS_POSIX) && !defined(OS_IOS) |
| void CrashReporterClient::GetProductNameAndVersion(const char** product_name, |
| const char** version) { |
| } |
| @@ -97,6 +97,7 @@ void CrashReporterClient::GetProductNameAndVersion(std::string* product_name, |
| std::string* version, |
| std::string* channel) {} |
| |
| +#if !defined(OS_MACOSX) |
| base::FilePath CrashReporterClient::GetReporterLogFilename() { |
| return base::FilePath(); |
| } |
| @@ -106,6 +107,7 @@ bool CrashReporterClient::HandleCrashDump(const char* crashdump_filename, |
| return false; |
| } |
| #endif |
| +#endif |
| |
| #if defined(OS_WIN) |
| bool CrashReporterClient::GetCrashDumpLocation(base::string16* crash_dir) { |
| @@ -148,6 +150,32 @@ bool CrashReporterClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) { |
| return false; |
| } |
| |
| +bool CrashReporterClient::EnableBreakpadForProcess( |
| + const std::string& process_type) { |
| + return false; |
| +} |
| + |
| +std::string CrashReporterClient::GetCrashServerURL() { |
| + return std::string(); |
| +} |
| + |
| +void CrashReporterClient::GetCrashOptionalArguments( |
| + std::vector<std::string>* arguments) { |
| +} |
| + |
| +#if defined(OS_WIN) |
| +base::string16 CrashReporterClient::GetCrashExternalHandler( |
| + const base::string16& exe_dir) { |
| + return exe_dir + L"\\crashpad_handler.exe"; |
| +} |
| +#endif |
| + |
| +#if defined(OS_MACOSX) |
| +bool CrashReporterClient::EnableBrowserCrashForwarding() { |
| + return true; |
| +} |
| +#endif |
| + |
| #if defined(OS_ANDROID) |
| unsigned int CrashReporterClient::GetCrashDumpPercentage() { |
| return 100; |
| @@ -200,9 +228,11 @@ bool CrashReporterClient::ShouldMonitorCrashHandlerExpensively() { |
| return false; |
| } |
| |
| -bool CrashReporterClient::EnableBreakpadForProcess( |
| - const std::string& process_type) { |
| - return false; |
| +#if defined(OS_POSIX) && !defined(OS_MACOSX) |
| +CrashReporterClient::ParameterMap |
| +CrashReporterClient::FilterParameters(const ParameterMap& parameters) { |
| + return parameters; |
| } |
| +#endif |
| |
| } // namespace crash_reporter |
| diff --git components/crash/core/app/crash_reporter_client.h components/crash/core/app/crash_reporter_client.h |
| index 9cc78fc25840..f54cdbdf2fc4 100644 |
| --- components/crash/core/app/crash_reporter_client.h |
| +++ components/crash/core/app/crash_reporter_client.h |
| @@ -5,7 +5,9 @@ |
| #ifndef COMPONENTS_CRASH_CORE_APP_CRASH_REPORTER_CLIENT_H_ |
| #define COMPONENTS_CRASH_CORE_APP_CRASH_REPORTER_CLIENT_H_ |
| |
| +#include <map> |
| #include <string> |
| +#include <vector> |
| |
| #include "base/strings/string16.h" |
| #include "build/build_config.h" |
| @@ -91,7 +93,7 @@ class CrashReporterClient { |
| virtual int GetResultCodeRespawnFailed(); |
| #endif |
| |
| -#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) |
| +#if defined(OS_POSIX) && !defined(OS_IOS) |
| // Returns a textual description of the product type and version to include |
| // in the crash report. Neither out parameter should be set to NULL. |
| // TODO(jperaza): Remove the 2-parameter overload of this method once all |
| @@ -102,6 +104,7 @@ class CrashReporterClient { |
| std::string* version, |
| std::string* channel); |
| |
| +#if !defined(OS_MACOSX) |
| virtual base::FilePath GetReporterLogFilename(); |
| |
| // Custom crash minidump handler after the minidump is generated. |
| @@ -111,6 +114,7 @@ class CrashReporterClient { |
| // libc nor allocate memory normally. |
| virtual bool HandleCrashDump(const char* crashdump_filename, |
| uint64_t crash_pid); |
| +#endif |
| #endif |
| |
| // The location where minidump files should be written. Returns true if |
| @@ -210,6 +214,30 @@ class CrashReporterClient { |
| |
| // Returns true if breakpad should run in the given process type. |
| virtual bool EnableBreakpadForProcess(const std::string& process_type); |
| + |
| + // Returns the URL for submitting crash reports. |
| + virtual std::string GetCrashServerURL(); |
| + |
| + // Populate |arguments| with additional optional arguments. |
| + virtual void GetCrashOptionalArguments(std::vector<std::string>* arguments); |
| + |
| +#if defined(OS_WIN) |
| + // Returns the absolute path to the external crash handler exe. |
| + virtual base::string16 GetCrashExternalHandler(const base::string16& exe_dir); |
| +#endif |
| + |
| +#if defined(OS_MACOSX) |
| + // Returns true if forwarding of crashes to the system crash reporter is |
| + // enabled for the browser process. |
| + virtual bool EnableBrowserCrashForwarding(); |
| +#endif |
| + |
| +#if defined(OS_POSIX) && !defined(OS_MACOSX) |
| + // Provides an oportunity to modify the parameters that will be sent with a |
| + // crash upload. |
| + using ParameterMap = std::map<std::string, std::string>; |
| + virtual ParameterMap FilterParameters(const ParameterMap& parameters); |
| +#endif |
| }; |
| |
| } // namespace crash_reporter |
| diff --git components/crash/core/app/crashpad.cc components/crash/core/app/crashpad.cc |
| index 290b4692c16f..ef91dbdc369d 100644 |
| --- components/crash/core/app/crashpad.cc |
| +++ components/crash/core/app/crashpad.cc |
| @@ -151,7 +151,8 @@ void InitializeCrashpadImpl(bool initial_client, |
| // fallback. Forwarding is turned off for debug-mode builds even for the |
| // browser process, because the system's crash reporter can take a very long |
| // time to chew on symbols. |
| - if (!browser_process || is_debug_build) { |
| + if (!browser_process || is_debug_build || |
| + !GetCrashReporterClient()->EnableBrowserCrashForwarding()) { |
| crashpad::CrashpadInfo::GetCrashpadInfo() |
| ->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled); |
| } |
| diff --git components/crash/core/app/crashpad_mac.mm components/crash/core/app/crashpad_mac.mm |
| index b579521d5586..644756cf710c 100644 |
| --- components/crash/core/app/crashpad_mac.mm |
| +++ components/crash/core/app/crashpad_mac.mm |
| @@ -16,12 +16,15 @@ |
| #include "base/logging.h" |
| #include "base/mac/bundle_locations.h" |
| #include "base/mac/foundation_util.h" |
| +#include "base/path_service.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/strings/string_piece.h" |
| #include "base/strings/stringprintf.h" |
| #include "base/strings/sys_string_conversions.h" |
| #include "build/branding_buildflags.h" |
| #include "components/crash/core/app/crash_reporter_client.h" |
| +#include "components/crash/core/app/crash_switches.h" |
| +#include "content/public/common/content_paths.h" |
| #include "third_party/crashpad/crashpad/client/crash_report_database.h" |
| #include "third_party/crashpad/crashpad/client/crashpad_client.h" |
| #include "third_party/crashpad/crashpad/client/crashpad_info.h" |
| @@ -37,12 +40,25 @@ namespace { |
| std::map<std::string, std::string> GetProcessSimpleAnnotations() { |
| static std::map<std::string, std::string> annotations = []() -> auto { |
| std::map<std::string, std::string> process_annotations; |
| + |
| @autoreleasepool { |
| NSBundle* outer_bundle = base::mac::OuterBundle(); |
| - NSString* product = base::mac::ObjCCast<NSString>([outer_bundle |
| - objectForInfoDictionaryKey:base::mac::CFToNSCast(kCFBundleNameKey)]); |
| - process_annotations["prod"] = |
| - base::SysNSStringToUTF8(product).append("_Mac"); |
| + |
| + CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); |
| + const char* product_name = ""; |
| + const char* product_version = ""; |
| + crash_reporter_client->GetProductNameAndVersion(&product_name, |
| + &product_version); |
| + |
| + if (strlen(product_name) == 0) { |
| + NSString* product = base::mac::ObjCCast<NSString>([outer_bundle |
| + objectForInfoDictionaryKey:base::mac::CFToNSCast( |
| + kCFBundleNameKey)]); |
| + process_annotations["product"] = |
| + base::SysNSStringToUTF8(product).append("_Mac"); |
| + } else { |
| + process_annotations["product"] = product_name; |
| + } |
| |
| #if BUILDFLAG(GOOGLE_CHROME_BRANDING) |
| // Empty means stable. |
| @@ -58,12 +74,16 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() { |
| process_annotations["channel"] = ""; |
| } |
| |
| - NSString* version = |
| - base::mac::ObjCCast<NSString>([base::mac::FrameworkBundle() |
| - objectForInfoDictionaryKey:@"CFBundleShortVersionString"]); |
| - process_annotations["ver"] = base::SysNSStringToUTF8(version); |
| + if (strlen(product_version) == 0) { |
| + NSString* version = |
| + base::mac::ObjCCast<NSString>([base::mac::FrameworkBundle() |
| + objectForInfoDictionaryKey:@"CFBundleShortVersionString"]); |
| + process_annotations["version"] = base::SysNSStringToUTF8(version); |
| + } else { |
| + process_annotations["version"] = product_version; |
| + } |
| |
| - process_annotations["plat"] = std::string("OS X"); |
| + process_annotations["platform"] = std::string("macos"); |
| } // @autoreleasepool |
| return process_annotations; |
| }(); |
| @@ -123,10 +143,10 @@ base::FilePath PlatformCrashpadInitialization( |
| |
| if (initial_client) { |
| @autoreleasepool { |
| - base::FilePath framework_bundle_path = base::mac::FrameworkBundlePath(); |
| - base::FilePath handler_path = |
| - framework_bundle_path.Append("Helpers").Append( |
| - "chrome_crashpad_handler"); |
| + // Use the same subprocess helper exe. |
| + base::FilePath handler_path; |
| + base::PathService::Get(content::CHILD_PROCESS_EXE, &handler_path); |
| + DCHECK(!handler_path.empty()); |
| |
| // Is there a way to recover if this fails? |
| CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); |
| @@ -138,7 +158,7 @@ base::FilePath PlatformCrashpadInitialization( |
| // crash server won't have symbols for any other build types. |
| std::string url = "https://clients2.google.com/cr/report"; |
| #else |
| - std::string url; |
| + std::string url = crash_reporter_client->GetCrashServerURL(); |
| #endif |
| |
| std::vector<std::string> arguments; |
| @@ -161,6 +181,12 @@ base::FilePath PlatformCrashpadInitialization( |
| "--reset-own-crash-exception-port-to-system-default"); |
| } |
| |
| + // Since we're using the same subprocess helper exe we must specify the |
| + // process type. |
| + arguments.push_back(std::string("--type=") + switches::kCrashpadHandler); |
| + |
| + crash_reporter_client->GetCrashOptionalArguments(&arguments); |
| + |
| bool result = GetCrashpadClient().StartHandler( |
| handler_path, database_path, metrics_path, url, |
| GetProcessSimpleAnnotations(), arguments, true, false); |
| diff --git components/crash/core/app/crashpad_win.cc components/crash/core/app/crashpad_win.cc |
| index 669f5bea844d..734163c0aad1 100644 |
| --- components/crash/core/app/crashpad_win.cc |
| +++ components/crash/core/app/crashpad_win.cc |
| @@ -36,8 +36,8 @@ void GetPlatformCrashpadAnnotations( |
| base::string16 product_name, version, special_build, channel_name; |
| crash_reporter_client->GetProductNameAndVersion( |
| exe_file, &product_name, &version, &special_build, &channel_name); |
| - (*annotations)["prod"] = base::UTF16ToUTF8(product_name); |
| - (*annotations)["ver"] = base::UTF16ToUTF8(version); |
| + (*annotations)["product"] = base::UTF16ToUTF8(product_name); |
| + (*annotations)["version"] = base::UTF16ToUTF8(version); |
| #if BUILDFLAG(GOOGLE_CHROME_BRANDING) |
| // Empty means stable. |
| const bool allow_empty_channel = true; |
| @@ -49,9 +49,9 @@ void GetPlatformCrashpadAnnotations( |
| if (!special_build.empty()) |
| (*annotations)["special"] = base::UTF16ToUTF8(special_build); |
| #if defined(ARCH_CPU_X86) |
| - (*annotations)["plat"] = std::string("Win32"); |
| + (*annotations)["platform"] = std::string("win32"); |
| #elif defined(ARCH_CPU_X86_64) |
| - (*annotations)["plat"] = std::string("Win64"); |
| + (*annotations)["platform"] = std::string("win64"); |
| #endif |
| } |
| |
| @@ -66,7 +66,9 @@ base::FilePath PlatformCrashpadInitialization( |
| base::FilePath metrics_path; // Only valid in the browser process. |
| |
| const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME"; |
| +#if defined(GOOGLE_CHROME_BUILD) |
| const char kServerUrlVar[] = "CHROME_CRASHPAD_SERVER_URL"; |
| +#endif |
| std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| |
| CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); |
| @@ -87,13 +89,13 @@ base::FilePath PlatformCrashpadInitialization( |
| |
| #if BUILDFLAG(GOOGLE_CHROME_BRANDING) |
| std::string url = "https://clients2.google.com/cr/report"; |
| -#else |
| - std::string url; |
| -#endif |
| |
| // Allow the crash server to be overridden for testing. If the variable |
| // isn't present in the environment then the default URL will remain. |
| env->GetVar(kServerUrlVar, &url); |
| +#else |
| + std::string url = crash_reporter_client->GetCrashServerURL(); |
| +#endif |
| |
| base::FilePath exe_file(exe_path); |
| if (exe_file.empty()) { |
| @@ -104,13 +106,14 @@ base::FilePath PlatformCrashpadInitialization( |
| exe_file = base::FilePath(exe_file_path); |
| } |
| |
| - // If the handler is embedded in the binary (e.g. chrome, setup), we |
| - // reinvoke it with --type=crashpad-handler. Otherwise, we use the |
| - // standalone crashpad_handler.exe (for tests, etc.). |
| std::vector<std::string> start_arguments(initial_arguments); |
| + |
| + // Always add --type=crashpad-handler because the value is expected by |
| + // CefExecuteProcess. |
| + start_arguments.push_back( |
| + std::string("--type=") + switches::kCrashpadHandler); |
| + |
| if (embedded_handler) { |
| - start_arguments.push_back(std::string("--type=") + |
| - switches::kCrashpadHandler); |
| if (!user_data_dir.empty()) { |
| start_arguments.push_back(std::string("--user-data-dir=") + |
| user_data_dir); |
| @@ -121,9 +124,12 @@ base::FilePath PlatformCrashpadInitialization( |
| start_arguments.push_back("/prefetch:7"); |
| } else { |
| base::FilePath exe_dir = exe_file.DirName(); |
| - exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); |
| + exe_file = base::FilePath( |
| + crash_reporter_client->GetCrashExternalHandler(exe_dir.value())); |
| } |
| |
| + crash_reporter_client->GetCrashOptionalArguments(&start_arguments); |
| + |
| std::vector<std::string> arguments(start_arguments); |
| |
| if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) { |