add debug driver destroy method

This commit is contained in:
王劲鹏 2019-11-22 11:44:20 +08:00
parent 93cb80f6f8
commit 6ed34dbbbf
5 changed files with 13 additions and 1 deletions

View File

@ -148,7 +148,7 @@ public class DoricContext {
doricDebugDriver = new DoricDebugDriver(new IStatusCallback() {
@Override
public void start() {
isDebugging=true;
isDebugging = true;
callEntity(DoricConstant.DORIC_ENTITY_INIT, initParams);
callEntity(DoricConstant.DORIC_ENTITY_CREATE);
}
@ -156,6 +156,7 @@ public class DoricContext {
}
public void stopDebug() {
doricDebugDriver.destroy();
isDebugging = false;
callEntity(DoricConstant.DORIC_ENTITY_INIT, initParams);
callEntity(DoricConstant.DORIC_ENTITY_CREATE);

View File

@ -126,4 +126,9 @@ public class DoricDebugDriver implements IDoricDriver {
public DoricRegistry getRegistry() {
return doricJSEngine.getRegistry();
}
public void destroy() {
doricJSEngine.teardown();
mBridgeExecutor.shutdown();
}
}

View File

@ -69,6 +69,7 @@ public class DebugContextPanel extends DialogFragment {
jsonObject.addProperty("projectHome", BuildConfig.PROJECT_HOME);
jsonObject.addProperty("source", doricContext.getSource().replace(".js", ".ts"));
Doric.sendDevCommand(IDevKit.Command.DEBUG, jsonObject);
dismissAllowingStateLoss();
}
});

View File

@ -170,6 +170,7 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time
public void teardown() {
mDoricJSE.teardown();
mTimerExtension.teardown();
}
private void loadBuiltinJS(String assetName) {

View File

@ -69,6 +69,10 @@ public class DoricTimerExtension implements Handler.Callback {
return true;
}
public void teardown() {
mTimerHandler.removeCallbacksAndMessages(null);
}
private class TimerInfo {
long timerId;
long time;