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 import 'dart:convert'; | 7 import 'dart:convert'; |
8 | 8 |
9 import 'package:async/async.dart'; | 9 import 'package:async/async.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; |
11 | 11 |
12 import 'breakpoint.dart'; | 12 import 'breakpoint.dart'; |
13 import 'error.dart'; | 13 import 'error.dart'; |
14 import 'exceptions.dart'; | 14 import 'exceptions.dart'; |
15 import 'library.dart'; | 15 import 'library.dart'; |
16 import 'pause_event.dart'; | 16 import 'pause_event.dart'; |
17 import 'scope.dart'; | 17 import 'scope.dart'; |
18 import 'script.dart'; | |
18 import 'sentinel.dart'; | 19 import 'sentinel.dart'; |
20 import 'source_report.dart'; | |
19 import 'stack.dart'; | 21 import 'stack.dart'; |
20 import 'stream_manager.dart'; | 22 import 'stream_manager.dart'; |
21 import 'utils.dart'; | 23 import 'utils.dart'; |
22 | 24 |
23 VMIsolateRef newVMIsolateRef(rpc.Peer peer, StreamManager streams, Map json) { | 25 VMIsolateRef newVMIsolateRef(rpc.Peer peer, StreamManager streams, Map json) { |
24 if (json == null) return null; | 26 if (json == null) return null; |
25 assert(json["type"] == "@Isolate" || json["type"] == "Isolate"); | 27 assert(json["type"] == "@Isolate" || json["type"] == "Isolate"); |
26 var scope = new Scope(peer, streams, json["id"]); | 28 var scope = new Scope(peer, streams, json["id"]); |
27 return new VMIsolateRef._(scope, json); | 29 return new VMIsolateRef._(scope, json); |
28 } | 30 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 /// | 337 /// |
336 /// This is supported as of VM service version 3.1, or Dart SDK version 1.14. | 338 /// This is supported as of VM service version 3.1, or Dart SDK version 1.14. |
337 Future<Object> invokeExtension(String method, [Map<String, String> params]) { | 339 Future<Object> invokeExtension(String method, [Map<String, String> params]) { |
338 if (!method.startsWith('ext.')) { | 340 if (!method.startsWith('ext.')) { |
339 throw new ArgumentError.value(method, 'method', | 341 throw new ArgumentError.value(method, 'method', |
340 'must begin with "ext." prefix'); | 342 'must begin with "ext." prefix'); |
341 } | 343 } |
342 return _scope.sendRequest(method, params); | 344 return _scope.sendRequest(method, params); |
343 } | 345 } |
344 | 346 |
347 Future<VMSourceReport> getSourceReport( | |
348 {bool includeCoverageReport, | |
349 bool includePossibleBreakpoints, | |
350 VMScriptRef script, | |
351 int tokenPos, | |
352 int endTokenPos, | |
353 bool forceCompile}) async { | |
354 | |
nweiz
2016/04/28 19:44:00
Nit: Remove this line.
kevmoo
2016/04/28 20:26:05
Done.
| |
355 var reports = <String>[]; | |
356 if (includeCoverageReport == true) { | |
357 reports.add('Coverage'); | |
358 } | |
359 | |
360 if (includePossibleBreakpoints == true) { | |
361 reports.add('PossibleBreakpoints'); | |
362 } | |
363 | |
364 var params = <String, dynamic>{'reports': reports}; | |
365 | |
366 if (script != null) { | |
367 params['scriptId'] = getScriptId(script); | |
368 } | |
369 | |
370 if (tokenPos != null) { | |
371 params['tokenPos'] = tokenPos; | |
372 } | |
373 | |
374 if (endTokenPos != null) { | |
375 params['endTokenPos'] = endTokenPos; | |
376 } | |
377 | |
378 var json = await _scope.sendRequest('getSourceReport', params); | |
379 | |
380 return newSourceReport(_scope, json); | |
381 } | |
382 | |
345 bool operator ==(other) => other is VMIsolateRef && | 383 bool operator ==(other) => other is VMIsolateRef && |
346 other._scope.isolateId == _scope.isolateId; | 384 other._scope.isolateId == _scope.isolateId; |
347 | 385 |
348 int get hashCode => _scope.isolateId.hashCode; | 386 int get hashCode => _scope.isolateId.hashCode; |
349 | 387 |
350 String toString() => name; | 388 String toString() => name; |
351 } | 389 } |
352 | 390 |
353 /// A full isolate on the remote VM. | 391 /// A full isolate on the remote VM. |
354 class VMIsolate extends VMIsolateRef { | 392 class VMIsolate extends VMIsolateRef { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 /// The kind, which identifies the type of event and its source. | 499 /// The kind, which identifies the type of event and its source. |
462 final String kind; | 500 final String kind; |
463 | 501 |
464 /// The event's payload. | 502 /// The event's payload. |
465 final Map data; | 503 final Map data; |
466 | 504 |
467 VMExtensionEvent._(Map json) | 505 VMExtensionEvent._(Map json) |
468 : kind = json['extensionKind'], | 506 : kind = json['extensionKind'], |
469 data = json['extensionData']; | 507 data = json['extensionData']; |
470 } | 508 } |
OLD | NEW |