OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.sdk.internal.wip; | 5 package org.chromium.sdk.internal.wip; |
6 | 6 |
7 import java.util.ArrayList; | 7 import java.util.ArrayList; |
8 import java.util.List; | 8 import java.util.List; |
9 import java.util.Map; | 9 import java.util.Map; |
10 import java.util.concurrent.atomic.AtomicInteger; | 10 import java.util.concurrent.atomic.AtomicInteger; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 public WipParamsWithResponse<CallFunctionOnData> getParams() { | 198 public WipParamsWithResponse<CallFunctionOnData> getParams() { |
199 List<CallArgumentParam> arguments; | 199 List<CallArgumentParam> arguments; |
200 if (additionalObjectIds.isEmpty()) { | 200 if (additionalObjectIds.isEmpty()) { |
201 arguments = null; | 201 arguments = null; |
202 } else { | 202 } else { |
203 arguments = new ArrayList<CallArgumentParam>(additionalObjectIds.siz
e()); | 203 arguments = new ArrayList<CallArgumentParam>(additionalObjectIds.siz
e()); |
204 for (String objectId : additionalObjectIds) { | 204 for (String objectId : additionalObjectIds) { |
205 arguments.add(new CallArgumentParam(null, objectId)); | 205 arguments.add(new CallArgumentParam(null, objectId)); |
206 } | 206 } |
207 } | 207 } |
208 return new CallFunctionOnParams(thisObjectIdFinal, functionText, argum
ents, true); | 208 return new CallFunctionOnParams(thisObjectIdFinal, functionText, argum
ents, null, true); |
209 } | 209 } |
210 | 210 |
211 @Override | 211 @Override |
212 public Step<JsVariable> processResponse(CallFunctionOnData response) { | 212 public Step<JsVariable> processResponse(CallFunctionOnData response) { |
213 if (response.wasThrown() == Boolean.TRUE) { | 213 if (response.wasThrown() == Boolean.TRUE) { |
214 return createHandleErrorStep(response.result()); | 214 return createHandleErrorStep(response.result()); |
215 } | 215 } |
216 return createEvaluateStep(evaluateCommandHandler); | 216 return createEvaluateStep(evaluateCommandHandler); |
217 } | 217 } |
218 | 218 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 /** | 270 /** |
271 * An alternative spin-off in the relay, that handles an exception we ran in
to. | 271 * An alternative spin-off in the relay, that handles an exception we ran in
to. |
272 * The additional step is needed because the exception message is only avail
able from | 272 * The additional step is needed because the exception message is only avail
able from |
273 * its 'message' pseudo-property (a getter). | 273 * its 'message' pseudo-property (a getter). |
274 */ | 274 */ |
275 private Step<JsVariable> createHandleErrorStep(final RemoteObjectValue remot
eObjectValue) { | 275 private Step<JsVariable> createHandleErrorStep(final RemoteObjectValue remot
eObjectValue) { |
276 return new WipRelayRunner.SendStepWithResponse<CallFunctionOnData, JsVaria
ble>() { | 276 return new WipRelayRunner.SendStepWithResponse<CallFunctionOnData, JsVaria
ble>() { |
277 @Override | 277 @Override |
278 public WipParamsWithResponse<CallFunctionOnData> getParams() { | 278 public WipParamsWithResponse<CallFunctionOnData> getParams() { |
279 String functionText = "function() { return String(this.message); }"; | 279 String functionText = "function() { return String(this.message); }"; |
280 return new CallFunctionOnParams(remoteObjectValue.objectId(), function
Text, null, true); | 280 return new CallFunctionOnParams(remoteObjectValue.objectId(), function
Text, null, null, true); |
281 } | 281 } |
282 | 282 |
283 @Override | 283 @Override |
284 public Step<JsVariable> processResponse(CallFunctionOnData response) | 284 public Step<JsVariable> processResponse(CallFunctionOnData response) |
285 throws ProcessException { | 285 throws ProcessException { |
286 throw new ProcessException("Helper script failed on remote: " + | 286 throw new ProcessException("Helper script failed on remote: " + |
287 response.result().value()); | 287 response.result().value()); |
288 } | 288 } |
289 | 289 |
290 @Override | 290 @Override |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 callback.failure(new Exception("Failed to inject evaluate helper script
into remote VM", | 332 callback.failure(new Exception("Failed to inject evaluate helper script
into remote VM", |
333 exception)); | 333 exception)); |
334 } | 334 } |
335 }; | 335 }; |
336 | 336 |
337 return tabImpl.getCommandProcessor().send(evaluateParams, wrappedCallback, s
yncCallback); | 337 return tabImpl.getCommandProcessor().send(evaluateParams, wrappedCallback, s
yncCallback); |
338 } | 338 } |
339 | 339 |
340 private static final String GLOBAL_VARIABLE_NAME = "_com_chromium_debug_helper
"; | 340 private static final String GLOBAL_VARIABLE_NAME = "_com_chromium_debug_helper
"; |
341 } | 341 } |
OLD | NEW |