Commit 8b71531f authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Fix DecoderService not starting with isolated splits enabled

The fix for crbug.com/1146745 started using the ClassLoader from
ContextUtils.getApplicationContext() for loading service classes. In the
browser process, this ClassLoader will be the chrome module ClassLoader.
DecoderService runs in it's own process, so the application does not
load the chrome specific code. This change makes sure the application
ClassLoader can actually load the service class before replacing the
passed in context.

Bug: 1152467
Change-Id: I82b4081afc349fec2e540a5763586153b50b67b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2558957Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830839}
parent 4d5e8304
......@@ -41,12 +41,13 @@ public class SplitCompatUtils {
}
/**
* Constructs a new instance of the given class name using the class loader from the context.
* Constructs a new instance of the given class name. If the application context class loader
* can load the class, that class loader will be used, otherwise the class loader from the
* passed in context will be used.
*/
public static Object newInstance(Context context, String className) {
// TODO(crbug.com/1142589): If this crash fix works we can remove the context arg from here.
Context appContext = ContextUtils.getApplicationContext();
if (appContext != null) {
if (appContext != null && canLoadClass(appContext.getClassLoader(), className)) {
context = appContext;
}
try {
......
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