android: optimize hot reload operation which causes render error
This commit is contained in:
parent
d391cb8348
commit
2f9afac7bd
@ -245,16 +245,20 @@ public class DoricContext {
|
||||
|
||||
public void reload(String script) {
|
||||
retainedJavaValues.clear();
|
||||
getDriver().destroyContext(getContextId());
|
||||
IDoricDriver driver = getDriver();
|
||||
driver.destroyContext(getContextId()).synchronous().get();
|
||||
for (DoricJavaPlugin javaPlugin : mPluginMap.values()) {
|
||||
javaPlugin.onTearDown();
|
||||
}
|
||||
mPluginMap.clear();
|
||||
if (driver instanceof DoricNativeDriver) {
|
||||
((DoricNativeDriver) driver).clearPendingJobs();
|
||||
}
|
||||
this.script = script;
|
||||
this.mRootNode.setId("");
|
||||
this.mRootNode.clearSubModel();
|
||||
this.mRootNode.getView().removeAllViews();
|
||||
getDriver().createContext(mContextId, script, source);
|
||||
driver.createContext(mContextId, script, source);
|
||||
init(this.extra);
|
||||
callEntity(DoricConstant.DORIC_ENTITY_CREATE);
|
||||
callEntity(DoricConstant.DORIC_ENTITY_BUILD, this.initParams);
|
||||
|
@ -232,4 +232,8 @@ public class DoricNativeDriver implements IDoricDriver {
|
||||
public DoricJSEngine getDoricJSEngine() {
|
||||
return doricJSEngine;
|
||||
}
|
||||
|
||||
public void clearPendingJobs() {
|
||||
this.mUIHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user