Commit 99a09bf4 authored by Fred Mello's avatar Fred Mello Committed by Commit Bot

Fix crash caused by calling CommandLine from the browser_restart_process

Solution to lazily instantiate the InstallEngine and avoid calling
the CommandLine will fix the problem for the VrModule's early call to
isInstalled() [see ChromeApplication.java (startActivity)].

Related to:
https://chromium-review.googlesource.com/c/chromium/src/+/1813520

Bug: 1010887, 1005802
Change-Id: I9d217abb0f9e09f97054fe0d3c6afee59aac198c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1837657
Commit-Queue: Fred Mello <fredmello@chromium.org>
Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702451}
parent a8491805
......@@ -17,7 +17,8 @@ import org.chromium.components.module_installer.engine.InstallListener;
* modules can be moved in and out from the base more easily.
*/
class ModuleEngine implements InstallEngine {
private static InstallEngine sInternalEngine;
private static InstallEngine sInstallEngine;
private static EngineFactory sEngineFactory;
private final String mImplClassName;
......@@ -27,12 +28,12 @@ class ModuleEngine implements InstallEngine {
public ModuleEngine(String implClassName, EngineFactory engineFactory) {
mImplClassName = implClassName;
sInternalEngine = engineFactory.getEngine();
sEngineFactory = engineFactory;
}
@Override
public void initActivity(Activity activity) {
sInternalEngine.initActivity(activity);
getEngine().initActivity(activity);
}
@Override
......@@ -49,11 +50,19 @@ class ModuleEngine implements InstallEngine {
@Override
public void installDeferred(String moduleName) {
sInternalEngine.installDeferred(moduleName);
getEngine().installDeferred(moduleName);
}
@Override
public void install(String moduleName, InstallListener listener) {
sInternalEngine.install(moduleName, listener);
getEngine().install(moduleName, listener);
}
private static InstallEngine getEngine() {
// Lazily instantiate the engine - related to crbug/1010887.
if (sInstallEngine == null) {
sInstallEngine = sEngineFactory.getEngine();
}
return sInstallEngine;
}
}
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