Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/webkit/WebkitRuntime.java

Issue 328663002: Version 1.5.0-dev.4.5 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/webkit/WebkitRuntime.java
===================================================================
--- dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/webkit/WebkitRuntime.java (revision 37110)
+++ dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/webkit/WebkitRuntime.java (working copy)
@@ -129,6 +129,47 @@
}
}
+ public void callListLength(String objectId, final WebkitCallback<Integer> callback)
+ throws IOException {
+ if (objectId == null) {
+ WebkitResult<Integer> result = new WebkitResult<Integer>();
+ result.setResult(new Integer(0));
+ callback.handleResult(result);
+ return;
+ }
+
+ try {
+ JSONObject request = new JSONObject();
+
+ request.put("method", "Runtime.callFunctionOn");
+ request.put(
+ "params",
+ new JSONObject().put("objectId", objectId).put("functionDeclaration", "() => length").put(
+ "returnByValue",
+ false));
+
+ connection.sendRequest(request, new Callback() {
+ @Override
+ public void handleResult(JSONObject result) throws JSONException {
+ WebkitResult<WebkitRemoteObject> functionResult = convertEvaluateResult(result);
+
+ WebkitResult<Integer> r = new WebkitResult<Integer>();
+
+ if (functionResult.getWasThrown()) {
+ r.setError(functionResult.getResult().getValue());
+ } else {
+ r.setResult(functionResult.getResult() == null ? new Integer(0) : new Integer(
+ functionResult.getResult().getValue()));
+ }
+
+ callback.handleResult(r);
+ }
+ });
+ } catch (JSONException exception) {
+ throw new IOException(exception);
+ }
+ }
+
/**
* Calls the toString() method on the given remote object. This is a convenience method for the
* Runtime.callFunctionOn call.
@@ -151,9 +192,9 @@
request.put("method", "Runtime.callFunctionOn");
request.put(
"params",
- new JSONObject().put("objectId", objectId).put(
- "functionDeclaration",
- "() => toString()").put("returnByValue", false));
+ new JSONObject().put("objectId", objectId).put("functionDeclaration", "() => toString()").put(
+ "returnByValue",
+ false));
connection.sendRequest(request, new Callback() {
@Override

Powered by Google App Engine
This is Rietveld 408576698