OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 | 7 |
8 import 'package:async/async.dart'; | 8 import 'package:async/async.dart'; |
9 import 'package:crypto/crypto.dart'; | 9 import 'package:crypto/crypto.dart'; |
10 import 'package:json_rpc_2/json_rpc_2.dart' as rpc; | 10 import 'package:json_rpc_2/json_rpc_2.dart' as rpc; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 var response = await _scope.sendRequest( | 257 var response = await _scope.sendRequest( |
258 "addBreakpointWithScriptUri", params); | 258 "addBreakpointWithScriptUri", params); |
259 return newVMBreakpoint(_scope, response); | 259 return newVMBreakpoint(_scope, response); |
260 } on rpc.RpcException catch (error) { | 260 } on rpc.RpcException catch (error) { |
261 // Error 102 indicates that the breakpoint couldn't be created. | 261 // Error 102 indicates that the breakpoint couldn't be created. |
262 if (error.code == 102) return null; | 262 if (error.code == 102) return null; |
263 rethrow; | 263 rethrow; |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
| 267 /// Makes a raw RPC to a VM service extension registered in the isolate |
| 268 /// corresponding to the ID [number]. |
| 269 /// |
| 270 /// [method] must correspond to a VM service extension installed on the VM |
| 271 /// isolate and it must begin with prefix "ext.". |
| 272 /// |
| 273 /// [params] are passed to the extension handler and must be serializable to |
| 274 /// a JSON string. |
| 275 Future<Map> invokeExtension(String method, [Map<String, Object> params]) { |
| 276 if (!method.startsWith('ext.')) { |
| 277 throw new ArgumentError.value(method, 'method', |
| 278 'must begin with "ext." prefix'); |
| 279 } |
| 280 return _scope.sendRequest(method, params); |
| 281 } |
| 282 |
267 bool operator ==(other) => other is VMIsolateRef && | 283 bool operator ==(other) => other is VMIsolateRef && |
268 other._scope.isolateId == _scope.isolateId; | 284 other._scope.isolateId == _scope.isolateId; |
269 | 285 |
270 int get hashCode => _scope.isolateId.hashCode; | 286 int get hashCode => _scope.isolateId.hashCode; |
271 | 287 |
272 String toString() => name; | 288 String toString() => name; |
273 } | 289 } |
274 | 290 |
275 /// A full isolate on the remote VM. | 291 /// A full isolate on the remote VM. |
276 class VMIsolate extends VMIsolateRef { | 292 class VMIsolate extends VMIsolateRef { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 374 |
359 /// The isolate continues until it exits the current function. | 375 /// The isolate continues until it exits the current function. |
360 static const out = const VMStep._("Out"); | 376 static const out = const VMStep._("Out"); |
361 | 377 |
362 /// The string name of the step type. | 378 /// The string name of the step type. |
363 final String _value; | 379 final String _value; |
364 | 380 |
365 const VMStep._(this._value); | 381 const VMStep._(this._value); |
366 | 382 |
367 String toString() => _value; | 383 String toString() => _value; |
368 } | 384 } |
OLD | NEW |