use of com.stardust.lang.ThreadCompat in project Auto.js by hyb1996.
the class ScriptEngineService method execute.
public ScriptExecution execute(ScriptExecutionTask task) {
if (task.getListener() != null) {
task.setExecutionListener(new ScriptExecutionObserver.Wrapper(mScriptExecutionObserver, task.getListener()));
} else {
task.setExecutionListener(mScriptExecutionObserver);
}
ScriptSource source = task.getSource();
if (source instanceof JavaScriptSource) {
int mode = ((JavaScriptSource) source).getExecutionMode();
if ((mode & JavaScriptSource.EXECUTION_MODE_UI) != 0) {
return ScriptExecuteActivity.execute(mContext, mScriptEngineManager, task);
}
}
RunnableScriptExecution r;
if (source instanceof JavaScriptSource) {
r = new LoopedBasedJavaScriptExecution(mScriptEngineManager, task);
} else {
r = new RunnableScriptExecution(mScriptEngineManager, task);
}
if (task.getConfig().runInNewThread) {
new ThreadCompat(r).start();
} else {
r.run();
}
return r;
}
Aggregations