use of com.oracle.truffle.tools.chromeinspector.commands.Command in project graal by oracle.
the class InspectServerSession method onMessage.
public void onMessage(String message) {
Command cmd;
try {
cmd = new Command(message);
} catch (JSONException ex) {
PrintWriter err = context.getErr();
if (err != null) {
err.println("Illegal message: '" + message + "' " + ex.getLocalizedMessage());
}
return;
}
processThread.push(cmd);
}
use of com.oracle.truffle.tools.chromeinspector.commands.Command in project graal by oracle.
the class Session method connect.
private Object connect() {
if (iss != null) {
throw new InspectorStateException("The inspector session is already connected");
}
InspectorExecutionContext execContext = contextSupplier.get();
iss = InspectServerSession.create(execContext, false, new ConnectionWatcher());
iss.open(getListeners());
execContext.setSynchronous(true);
// Enable the Runtime by default
iss.sendCommand(new Command("{\"id\":0,\"method\":\"Runtime.enable\"}"));
return undefinedProvider.get();
}
use of com.oracle.truffle.tools.chromeinspector.commands.Command in project graal by oracle.
the class Session method post.
private void post(String method, TruffleObject paramsObject, TruffleObject callback) {
long id = cmdId.getAndIncrement();
Params params = null;
if (paramsObject != null) {
params = new Params(TruffleObject2JSON.fromObject(paramsObject));
}
if (callback != null) {
getListeners().addCallback(id, callback);
}
if (iss == null) {
throw new InspectorStateException("The inspector session is not connected.");
}
iss.sendCommand(new Command(id, method, params));
}
use of com.oracle.truffle.tools.chromeinspector.commands.Command in project graal by oracle.
the class InspectServerSession method sendText.
@Override
public void sendText(String message) throws IOException {
if (processThread == null) {
throw createClosedException();
}
Command cmd;
try {
cmd = new Command(message);
} catch (JSONException ex) {
PrintWriter err = context.getErr();
if (err != null) {
err.println("Illegal message: '" + message + "' " + ex.getLocalizedMessage());
}
return;
}
CommandProcessThread pt = processThread;
if (pt != null) {
pt.push(cmd);
}
}
Aggregations