use of com.oracle.truffle.tools.chromeinspector.types.Script in project graal by oracle.
the class BreakpointsHandler method createOneShotBreakpoint.
void createOneShotBreakpoint(Location location) throws CommandProcessException {
Script script = slh.getScript(location.getScriptId());
if (script == null) {
throw new CommandProcessException("No script with id '" + location.getScriptId() + "'");
}
Breakpoint bp = createBuilder(script.getSource(), location.getLine(), location.getColumn()).oneShot().build();
ds.install(bp);
}
use of com.oracle.truffle.tools.chromeinspector.types.Script in project graal by oracle.
the class BreakpointsHandler method createBreakpoint.
Params createBreakpoint(Location location, String condition) throws CommandProcessException {
Script script = slh.getScript(location.getScriptId());
if (script == null) {
throw new CommandProcessException("No script with id '" + location.getScriptId() + "'");
}
Breakpoint bp = createBuilder(script.getSource(), location.getLine(), location.getColumn()).resolveListener(resolvedHandler).build();
if (condition != null && !condition.isEmpty()) {
bp.setCondition(condition);
}
bp = ds.install(bp);
JSONArray locations = new JSONArray();
long id;
synchronized (bpIDs) {
id = ++lastID;
bpIDs.put(bp, id);
SourceSection section = resolvedBreakpoints.remove(bp);
if (section != null) {
Location resolvedLocation = new Location(location.getScriptId(), section.getStartLine(), section.getStartColumn());
locations.put(resolvedLocation.toJSON());
}
}
JSONObject json = new JSONObject();
json.put("breakpointId", Long.toString(id));
locations.put(location.toJSON());
json.put("locations", locations);
return new Params(json);
}
use of com.oracle.truffle.tools.chromeinspector.types.Script in project graal by oracle.
the class ScriptsHandler method assureLoaded.
int assureLoaded(Source source) {
Script scr;
URI uri = source.getURI();
int id;
LoadScriptListener[] listenersToNotify;
synchronized (sourceIDs) {
Integer eid = sourceIDs.get(source);
if (eid != null) {
return eid;
}
id = scripts.size();
String sourceUrl = getNiceStringFromURI(uri);
scr = new Script(id, sourceUrl, source);
sourceIDs.put(source, id);
scripts.add(scr);
listenersToNotify = listeners.toArray(new LoadScriptListener[listeners.size()]);
}
for (LoadScriptListener l : listenersToNotify) {
l.loadedScript(scr);
}
return id;
}
use of com.oracle.truffle.tools.chromeinspector.types.Script in project graal by oracle.
the class ScriptsHandler method addLoadScriptListener.
void addLoadScriptListener(LoadScriptListener listener) {
List<Script> scriptsToNotify;
synchronized (sourceIDs) {
scriptsToNotify = new ArrayList<>(scripts);
listeners.add(listener);
}
for (Script scr : scriptsToNotify) {
listener.loadedScript(scr);
}
}
Aggregations