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

Unified Diff: android_webview/crash_reporter/aw_microdump_crash_reporter.cc

Issue 902093003: [android-webview] Enable breakpad microdump crash reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@crash_refactor_for_webview
Patch Set: Fix aw_microdump_crash_reporter_disabled_in_android_builds Created 5 years, 10 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..490cd9b7de7df929be54e441b5d5d16d774c861b
--- /dev/null
+++ b/android_webview/crash_reporter/aw_microdump_crash_reporter.cc
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "android_webview/crash_reporter/aw_microdump_crash_reporter.h"
+
+#include "base/lazy_instance.h"
+#include "components/crash/app/breakpad_linux.h"
+#include "components/crash/app/crash_reporter_client.h"
+
+namespace android_webview {
+namespace crash_reporter {
+
+namespace {
+
+class AwCrashReporterClient : public ::crash_reporter::CrashReporterClient {
+ public:
+ AwCrashReporterClient() {}
+
+ // crash_reporter::CrashReporterClient implementation.
+ bool IsRunningUnattended() override { return false; }
+ bool GetCollectStatsConsent() override { return false; }
+
+ // Microdumps are always enabled in WebView builds, conversely to what happens
+ // in the case of the other Chrome for Android builds (where they are enabled
+ // only when NO_UNWIND_TABLES == 1).
+ bool ShouldEnableBreakpadMicrodumps() override { return true; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AwCrashReporterClient);
+};
+
+base::LazyInstance<AwCrashReporterClient>::Leaky g_crash_reporter_client =
+ LAZY_INSTANCE_INITIALIZER;
+
+bool g_enabled = false;
+
+} // namespace
+
+void EnableMicrodumpCrashReporter() {
+ if (g_enabled) {
+ NOTREACHED() << "EnableMicrodumpCrashReporter called more than once";
+ return;
+ }
+
+ ::crash_reporter::SetCrashReporterClient(g_crash_reporter_client.Pointer());
+
+ // |process_type| is not really relevant here, as long as it not empty.
+ breakpad::InitNonBrowserCrashReporterForAndroid("webview" /* process_type */);
+ g_enabled = true;
+}
+
+} // namespace crash_reporter
+} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698