forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android-webview] Enable breakpad microdump crash reporting
This CL: - Pulls in the dependencies required to build breakpad and the crash component. - Introduces a crash reporter for WebView which unconditionally enables microdumps (but not minidump uploads). - Introduces a fallback no-op implementation which avoids the burden of importing and supporting breakpad in the internal Android builds (which are going to be deprecated soon). Impact of this change on the WebView APK size: Before the change: 25700337 bytes After the change: 25720974 bytes Delta: 20637 bytes Impact of this change on the uncompressed libwebviewchromium.so lib: Before the change: 28547980 bytes After the change: 28576844 bytes Delta: 28864 bytes BUG=410294, 456494 TBR=mark@chromium.org Review URL: https://codereview.chromium.org/902093003 Cr-Commit-Position: refs/heads/master@{#315357}
- Loading branch information
Showing
6 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include_rules = [ | ||
"+components/crash", | ||
] |
54 changes: 54 additions & 0 deletions
54
android_webview/crash_reporter/aw_microdump_crash_reporter.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
16 changes: 16 additions & 0 deletions
16
android_webview/crash_reporter/aw_microdump_crash_reporter.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// 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. | ||
|
||
#ifndef ANDROID_WEBVIEW_CRASH_REPORTER_AW_MICRODUMP_CRASH_REPORTER_H_ | ||
#define ANDROID_WEBVIEW_CRASH_REPORTER_AW_MICRODUMP_CRASH_REPORTER_H_ | ||
|
||
namespace android_webview { | ||
namespace crash_reporter { | ||
|
||
void EnableMicrodumpCrashReporter(); | ||
|
||
} // namespace crash_reporter | ||
} // namespace android_webview | ||
|
||
#endif // ANDROID_WEBVIEW_CRASH_REPORTER_AW_MICRODUMP_CRASH_REPORTER_H_ |
21 changes: 21 additions & 0 deletions
21
android_webview/crash_reporter/aw_microdump_crash_reporter_disabled_in_android_builds.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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" | ||
|
||
// TODO(primiano): remove this once Android builds of WebView are deprecated. | ||
// This translation unit is a no-op fallback for AwCrashReporter. This is built | ||
// only when building in the Android tree. | ||
// The rationale of this hack is to avoid the cost of maintaining breakpad in | ||
// the Android tree, as the WebView build in Android itself is going to be | ||
// deprecated soon (crbug.com/440792). | ||
|
||
namespace android_webview { | ||
namespace crash_reporter { | ||
|
||
void EnableMicrodumpCrashReporter() { | ||
} | ||
|
||
} // namespace crash_reporter | ||
} // namespace android_webview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters