OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "android_webview/crash_reporter/aw_microdump_crash_reporter.h" |
| 6 |
| 7 #include "base/lazy_instance.h" |
| 8 #include "components/crash/app/breakpad_linux.h" |
| 9 #include "components/crash/app/crash_reporter_client.h" |
| 10 |
| 11 namespace android_webview { |
| 12 namespace crash_reporter { |
| 13 |
| 14 namespace { |
| 15 |
| 16 class AwCrashReporterClient : public ::crash_reporter::CrashReporterClient { |
| 17 public: |
| 18 AwCrashReporterClient() {} |
| 19 |
| 20 // crash_reporter::CrashReporterClient implementation. |
| 21 bool IsRunningUnattended() override { return false; } |
| 22 bool GetCollectStatsConsent() override { return false; } |
| 23 |
| 24 // Microdumps are always enabled in WebView builds, conversely to what happens |
| 25 // in the case of the other Chrome for Android builds (where they are enabled |
| 26 // only when NO_UNWIND_TABLES == 1). |
| 27 bool ShouldEnableBreakpadMicrodumps() override { return true; } |
| 28 |
| 29 private: |
| 30 DISALLOW_COPY_AND_ASSIGN(AwCrashReporterClient); |
| 31 }; |
| 32 |
| 33 base::LazyInstance<AwCrashReporterClient>::Leaky g_crash_reporter_client = |
| 34 LAZY_INSTANCE_INITIALIZER; |
| 35 |
| 36 bool g_enabled = false; |
| 37 |
| 38 } // namespace |
| 39 |
| 40 void EnableMicrodumpCrashReporter() { |
| 41 if (g_enabled) { |
| 42 NOTREACHED() << "EnableMicrodumpCrashReporter called more than once"; |
| 43 return; |
| 44 } |
| 45 |
| 46 ::crash_reporter::SetCrashReporterClient(g_crash_reporter_client.Pointer()); |
| 47 |
| 48 // |process_type| is not really relevant here, as long as it not empty. |
| 49 breakpad::InitNonBrowserCrashReporterForAndroid("webview" /* process_type */); |
| 50 g_enabled = true; |
| 51 } |
| 52 |
| 53 } // namespace crash_reporter |
| 54 } // namespace android_webview |
OLD | NEW |