Chromium Code Reviews| Index: android_webview/crash_reporter/aw_microdump_crash_reporter.cc |
| diff --git a/android_webview/crash_reporter/aw_microdump_crash_reporter.cc b/android_webview/crash_reporter/aw_microdump_crash_reporter.cc |
| index aac36e8c35324ff47551cb6dbf928975b0a0fef3..af5c07cfd3e12f63e371344399a0fe74eb6e6d81 100644 |
| --- a/android_webview/crash_reporter/aw_microdump_crash_reporter.cc |
| +++ b/android_webview/crash_reporter/aw_microdump_crash_reporter.cc |
| @@ -13,6 +13,7 @@ |
| #include "build/build_config.h" |
| #include "components/crash/content/app/breakpad_linux.h" |
| #include "components/crash/content/app/crash_reporter_client.h" |
| +#include "content/public/common/content_switches.h" |
| namespace android_webview { |
| namespace crash_reporter { |
| @@ -23,6 +24,9 @@ class AwCrashReporterClient : public ::crash_reporter::CrashReporterClient { |
| public: |
| AwCrashReporterClient() : dump_fd_(-1) {} |
| + // Does not use lock, can only be called immediately after creation. |
| + void set_crash_signal_fd(int fd) { dump_fd_ = fd; } |
| + |
| // crash_reporter::CrashReporterClient implementation. |
| bool IsRunningUnattended() override { return false; } |
| bool GetCollectStatsConsent() override { return false; } |
| @@ -40,6 +44,7 @@ class AwCrashReporterClient : public ::crash_reporter::CrashReporterClient { |
| int GetAndroidMinidumpDescriptor() override { return dump_fd_; } |
| bool DumpWithoutCrashingToFd(int fd) { |
| + DCHECK(dump_fd_ == -1); |
|
Torne
2015/12/16 14:48:35
Seems like we should have something at a higher le
mnaganov (inactive)
2015/12/16 19:10:12
I've already done that in my previous patch: https
|
| base::AutoLock lock(dump_lock_); |
| dump_fd_ = fd; |
| base::debug::DumpWithoutCrashing(); |
| @@ -109,7 +114,8 @@ bool SafeToUseSignalHandler() { |
| } // namespace |
| -void EnableMicrodumpCrashReporter(const std::string& process_type) { |
| +void EnableMicrodumpCrashReporter(const std::string& process_type, |
| + int crash_signal_fd) { |
| if (g_enabled) { |
| NOTREACHED() << "EnableMicrodumpCrashReporter called more than once"; |
| return; |
| @@ -122,7 +128,11 @@ void EnableMicrodumpCrashReporter(const std::string& process_type) { |
| } |
| #endif |
| - ::crash_reporter::SetCrashReporterClient(g_crash_reporter_client.Pointer()); |
| + AwCrashReporterClient* client = g_crash_reporter_client.Pointer(); |
| + if (process_type == switches::kRendererProcess && crash_signal_fd != -1) { |
| + client->set_crash_signal_fd(crash_signal_fd); |
| + } |
| + ::crash_reporter::SetCrashReporterClient(client); |
| breakpad::InitMicrodumpCrashHandlerIfNecessary(process_type); |
| g_enabled = true; |