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) {
|
public void reload(String script) {
|
||||||
retainedJavaValues.clear();
|
retainedJavaValues.clear();
|
||||||
getDriver().destroyContext(getContextId());
|
IDoricDriver driver = getDriver();
|
||||||
|
driver.destroyContext(getContextId()).synchronous().get();
|
||||||
for (DoricJavaPlugin javaPlugin : mPluginMap.values()) {
|
for (DoricJavaPlugin javaPlugin : mPluginMap.values()) {
|
||||||
javaPlugin.onTearDown();
|
javaPlugin.onTearDown();
|
||||||
}
|
}
|
||||||
mPluginMap.clear();
|
mPluginMap.clear();
|
||||||
|
if (driver instanceof DoricNativeDriver) {
|
||||||
|
((DoricNativeDriver) driver).clearPendingJobs();
|
||||||
|
}
|
||||||
this.script = script;
|
this.script = script;
|
||||||
this.mRootNode.setId("");
|
this.mRootNode.setId("");
|
||||||
this.mRootNode.clearSubModel();
|
this.mRootNode.clearSubModel();
|
||||||
this.mRootNode.getView().removeAllViews();
|
this.mRootNode.getView().removeAllViews();
|
||||||
getDriver().createContext(mContextId, script, source);
|
driver.createContext(mContextId, script, source);
|
||||||
init(this.extra);
|
init(this.extra);
|
||||||
callEntity(DoricConstant.DORIC_ENTITY_CREATE);
|
callEntity(DoricConstant.DORIC_ENTITY_CREATE);
|
||||||
callEntity(DoricConstant.DORIC_ENTITY_BUILD, this.initParams);
|
callEntity(DoricConstant.DORIC_ENTITY_BUILD, this.initParams);
|
||||||
|
@ -232,4 +232,8 @@ public class DoricNativeDriver implements IDoricDriver {
|
|||||||
public DoricJSEngine getDoricJSEngine() {
|
public DoricJSEngine getDoricJSEngine() {
|
||||||
return doricJSEngine;
|
return doricJSEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearPendingJobs() {
|
||||||
|
this.mUIHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user