Commit 8ad48cdf authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

[WebLayer] Handle child crashes when there is no crash reporter client

WebLayer's CrashReporterControllerImpl is is always initialized as
part of WebLayer initialization. Currently, CrashReporterControllerImpl
registers to observe child process crashes and process their minidumps
in its own initialization. This processing involves interaction with
the CrashReporterControllerClient. However, not all WebLayer embedders
set a client; e.g., WebLayer Shell does not. Without a client having
been set, a child process crash causes the app to crash due to
CrashReporterControllerImpl accessing a null client instance.

This CL changes CrashReporterControllerImpl to register for child
process crashes when its client is set.

Change-Id: I280b68766cc3c5e59ca02fa685575cfe67715f3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1980741Reviewed-by: default avatarTobias Sargeant <tobiasjs@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727539}
parent 2270e1fd
...@@ -48,15 +48,7 @@ public final class CrashReporterControllerImpl extends ICrashReporterController. ...@@ -48,15 +48,7 @@ public final class CrashReporterControllerImpl extends ICrashReporterController.
static CrashReporterControllerImpl sInstance = new CrashReporterControllerImpl(); static CrashReporterControllerImpl sInstance = new CrashReporterControllerImpl();
} }
private CrashReporterControllerImpl() { private CrashReporterControllerImpl() {}
ChildProcessCrashObserver.registerCrashCallback(
new ChildProcessCrashObserver.ChildCrashedCallback() {
@Override
public void childCrashed(int pid) {
processNewMinidumps();
}
});
}
public static CrashReporterControllerImpl getInstance() { public static CrashReporterControllerImpl getInstance() {
return Holder.sInstance; return Holder.sInstance;
...@@ -144,6 +136,15 @@ public final class CrashReporterControllerImpl extends ICrashReporterController. ...@@ -144,6 +136,15 @@ public final class CrashReporterControllerImpl extends ICrashReporterController.
if (mIsNativeInitialized) { if (mIsNativeInitialized) {
processNewMinidumps(); processNewMinidumps();
} }
// Now that there is a client, register to observe child process crashes.
ChildProcessCrashObserver.registerCrashCallback(
new ChildProcessCrashObserver.ChildCrashedCallback() {
@Override
public void childCrashed(int pid) {
processNewMinidumps();
}
});
} }
/** Start an async task to import crashes, and notify if any are found. */ /** Start an async task to import crashes, and notify if any are found. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment