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

Unified Diff: components/crash/content/app/breakpad_linux.cc

Issue 2635493002: Suppress browser microdump when renderer crashes in multiprocess WebView. (Closed)
Patch Set: rebase Created 3 years, 11 months 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 | « components/crash/content/app/breakpad_linux.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/crash/content/app/breakpad_linux.cc
diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc
index 6e78cb8028f500f9b93a2235a165ee814047c767..230799e81b6a124ab11ab48270167589f2b30d4e 100644
--- a/components/crash/content/app/breakpad_linux.cc
+++ b/components/crash/content/app/breakpad_linux.cc
@@ -101,6 +101,8 @@ ExceptionHandler* g_breakpad = nullptr;
const char* g_asan_report_str = nullptr;
#endif
#if defined(OS_ANDROID)
+#define G_DUMPS_SUPPRESSED_MAGIC 0x5AFECEDE
+uint32_t g_dumps_suppressed = 0;
char* g_process_type = nullptr;
ExceptionHandler* g_microdump = nullptr;
int g_signal_code_pipe_fd = -1;
@@ -576,13 +578,27 @@ void WriteAndroidPackage(MimeWriter& writer,
#endif // defined(OS_ANDROID)
void DumpProcess() {
- if (g_breakpad)
- g_breakpad->WriteMinidump();
-
#if defined(OS_ANDROID)
+ // Don't use g_breakpad and g_microdump directly here, because their
+ // output might currently be suppressed.
+ if (g_breakpad) {
+ ExceptionHandler(g_breakpad->minidump_descriptor(),
+ nullptr,
+ CrashDoneNoUpload,
+ nullptr,
+ false, -1).WriteMinidump();
+ }
// If microdumps are enabled write also a microdump on the system log.
- if (g_microdump)
- g_microdump->WriteMinidump();
+ if (g_microdump) {
+ ExceptionHandler(g_microdump->minidump_descriptor(),
+ nullptr,
+ MicrodumpCrashDone,
+ nullptr,
+ false, -1).WriteMinidump();
+ }
+#else
+ if (g_breakpad)
+ g_breakpad->WriteMinidump();
#endif
}
@@ -603,6 +619,10 @@ size_t WriteNewline() {
}
#if defined(OS_ANDROID)
+bool ShouldGenerateDump(void *context) {
+ return g_dumps_suppressed != G_DUMPS_SUPPRESSED_MAGIC;
+}
+
void AndroidLogWriteHorizontalRule() {
__android_log_write(ANDROID_LOG_WARN, kGoogleBreakpad,
"### ### ### ### ### ### ### ### ### ### ### ### ###");
@@ -756,7 +776,7 @@ void EnableCrashDumping(bool unattended) {
if (unattended) {
g_breakpad = new ExceptionHandler(
minidump_descriptor,
- nullptr,
+ ShouldGenerateDump,
Torne 2017/01/16 12:08:57 Does this need to be #if defined(OS_ANDROID)? The
Tobias Sargeant 2017/01/16 14:01:36 It certainly should be. Thanks.
CrashDoneNoUpload,
nullptr,
true, // Install handlers.
@@ -865,8 +885,8 @@ void EnableNonBrowserCrashDumping(const std::string& process_type,
const size_t process_type_len = process_type.size() + 1;
g_process_type = new char[process_type_len];
strncpy(g_process_type, process_type.c_str(), process_type_len);
- new google_breakpad::ExceptionHandler(MinidumpDescriptor(minidump_fd),
- nullptr, CrashDoneInProcessNoUpload, nullptr, true, -1);
+ new ExceptionHandler(MinidumpDescriptor(minidump_fd), ShouldGenerateDump,
+ CrashDoneInProcessNoUpload, nullptr, true, -1);
}
void MicrodumpInfo::SetGpuFingerprint(const std::string& gpu_fingerprint) {
@@ -923,7 +943,7 @@ void MicrodumpInfo::Initialize(const std::string& process_type,
}
g_microdump =
- new ExceptionHandler(descriptor, nullptr, MicrodumpCrashDone,
+ new ExceptionHandler(descriptor, ShouldGenerateDump, MicrodumpCrashDone,
reinterpret_cast<void*>(is_browser_process),
true, // Install handlers.
-1); // Server file descriptor. -1 for in-process.
@@ -1946,6 +1966,10 @@ void GenerateMinidumpOnDemandForAndroid(int dump_fd) {
.WriteMinidump();
}
}
+
+void SuppressDumpGeneration() {
+ g_dumps_suppressed = G_DUMPS_SUPPRESSED_MAGIC;
+}
#endif // OS_ANDROID
bool IsCrashReporterEnabled() {
« no previous file with comments | « components/crash/content/app/breakpad_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698