OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if (value.isList()) { | 50 if (value.isList()) { |
51 return new DartiumDebugIndexedValue(target, variable, value); | 51 return new DartiumDebugIndexedValue(target, variable, value); |
52 } else { | 52 } else { |
53 return new DartiumDebugValue(target, variable, value); | 53 return new DartiumDebugValue(target, variable, value); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 private DartiumDebugVariable variable; | 57 private DartiumDebugVariable variable; |
58 protected WebkitRemoteObject value; | 58 protected WebkitRemoteObject value; |
59 | 59 |
60 private VariableCollector variableCollector; | 60 protected VariableCollector variableCollector; |
61 | 61 |
62 protected DartiumDebugValue(DartiumDebugTarget target, DartiumDebugVariable va
riable, | 62 protected DartiumDebugValue(DartiumDebugTarget target, DartiumDebugVariable va
riable, |
63 WebkitRemoteObject value) { | 63 WebkitRemoteObject value) { |
64 super(target); | 64 super(target); |
65 | 65 |
66 this.variable = variable; | 66 this.variable = variable; |
67 this.value = value; | 67 this.value = value; |
68 } | 68 } |
69 | 69 |
70 public void computeDetail(final ValueCallback callback) { | 70 public void computeDetail(final ValueCallback callback) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 if (value.isString()) { | 190 if (value.isString()) { |
191 return DebuggerUtils.printString(value.getValue()); | 191 return DebuggerUtils.printString(value.getValue()); |
192 } | 192 } |
193 | 193 |
194 if (isPrimitive()) { | 194 if (isPrimitive()) { |
195 return value.getValue(); | 195 return value.getValue(); |
196 } | 196 } |
197 | 197 |
198 if (isListValue()) { | 198 if (isListValue()) { |
199 if (value.getClassName() != null) { | 199 if (value.getClassName() != null) { |
200 return value.getClassName() + "[" + value.getListLength() + "]"; | 200 return value.getClassName() + "[" + value.getListLength(getConnection())
+ "]"; |
201 } else { | 201 } else { |
202 return "List[" + value.getListLength() + "]"; | 202 return "List[" + value.getListLength(getConnection()) + "]"; |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 return value.getDescription(); | 206 return value.getDescription(); |
207 } | 207 } |
208 | 208 |
209 @Override | 209 @Override |
210 public String getId() { | 210 public String getId() { |
211 if (value == null || value.isNull()) { | 211 if (value == null || value.isNull()) { |
212 return null; | 212 return null; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 return variableCollector.getVariables(); | 261 return variableCollector.getVariables(); |
262 } catch (Throwable t) { | 262 } catch (Throwable t) { |
263 throw createDebugException(t); | 263 throw createDebugException(t); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 @Override | 267 @Override |
268 public boolean hasVariables() throws DebugException { | 268 public boolean hasVariables() throws DebugException { |
269 try { | 269 try { |
270 if (isListValue()) { | 270 return value.hasObjectId() && !value.isNull() && !value.isPrimitive(); |
271 return value.getListLength() > 0; | |
272 } else { | |
273 return value.hasObjectId(); | |
274 } | |
275 } catch (Throwable t) { | 271 } catch (Throwable t) { |
276 throw createDebugException(t); | 272 throw createDebugException(t); |
277 } | 273 } |
278 } | 274 } |
279 | 275 |
280 @Override | 276 @Override |
281 public boolean isAllocated() throws DebugException { | 277 public boolean isAllocated() throws DebugException { |
282 return true; | 278 return true; |
283 } | 279 } |
284 | 280 |
(...skipping 12 matching lines...) Expand all Loading... |
297 return value.isPrimitive(); | 293 return value.isPrimitive(); |
298 } | 294 } |
299 | 295 |
300 @Override | 296 @Override |
301 public void reset() { | 297 public void reset() { |
302 variableCollector = null; | 298 variableCollector = null; |
303 | 299 |
304 fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT)); | 300 fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT)); |
305 } | 301 } |
306 | 302 |
| 303 protected void populate() { |
| 304 if (value.hasObjectId()) { |
| 305 variableCollector = VariableCollector.createCollector( |
| 306 getTarget(), |
| 307 variable, |
| 308 Collections.singletonList(value)); |
| 309 } else { |
| 310 variableCollector = VariableCollector.empty(); |
| 311 } |
| 312 } |
| 313 |
307 private void evalOnGlobalContext(final String expression, | 314 private void evalOnGlobalContext(final String expression, |
308 final WebkitResult<WebkitRemoteObject> originalResult, final IWatchExpress
ionListener listener) { | 315 final WebkitResult<WebkitRemoteObject> originalResult, final IWatchExpress
ionListener listener) { |
309 try { | 316 try { |
310 getConnection().getRuntime().evaluate( | 317 getConnection().getRuntime().evaluate( |
311 expression, | 318 expression, |
312 null, | 319 null, |
313 false, | 320 false, |
314 new WebkitCallback<WebkitRemoteObject>() { | 321 new WebkitCallback<WebkitRemoteObject>() { |
315 @Override | 322 @Override |
316 public void handleResult(WebkitResult<WebkitRemoteObject> result) { | 323 public void handleResult(WebkitResult<WebkitRemoteObject> result) { |
(...skipping 29 matching lines...) Expand all Loading... |
346 } | 353 } |
347 | 354 |
348 try { | 355 try { |
349 JSONObject obj = new JSONObject(objectId); | 356 JSONObject obj = new JSONObject(objectId); |
350 return obj.getString("id"); | 357 return obj.getString("id"); |
351 } catch (Throwable t) { | 358 } catch (Throwable t) { |
352 return null; | 359 return null; |
353 } | 360 } |
354 } | 361 } |
355 | 362 |
356 private void populate() { | |
357 if (value.hasObjectId()) { | |
358 variableCollector = VariableCollector.createCollector( | |
359 getTarget(), | |
360 variable, | |
361 Collections.singletonList(value)); | |
362 } else { | |
363 variableCollector = VariableCollector.empty(); | |
364 } | |
365 } | |
366 | |
367 } | 363 } |
OLD | NEW |