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

View File

@ -126,4 +126,9 @@ public class DoricDebugDriver implements IDoricDriver {
public DoricRegistry getRegistry() { public DoricRegistry getRegistry() {
return doricJSEngine.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("projectHome", BuildConfig.PROJECT_HOME);
jsonObject.addProperty("source", doricContext.getSource().replace(".js", ".ts")); jsonObject.addProperty("source", doricContext.getSource().replace(".js", ".ts"));
Doric.sendDevCommand(IDevKit.Command.DEBUG, jsonObject); Doric.sendDevCommand(IDevKit.Command.DEBUG, jsonObject);
dismissAllowingStateLoss();
} }
}); });

View File

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

View File

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