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 'sentinel.dart'; | 18 import 'sentinel.dart'; |
19 import 'source_report.dart'; | |
19 import 'stack.dart'; | 20 import 'stack.dart'; |
20 import 'stream_manager.dart'; | 21 import 'stream_manager.dart'; |
21 import 'utils.dart'; | 22 import 'utils.dart'; |
22 | 23 |
23 VMIsolateRef newVMIsolateRef(rpc.Peer peer, StreamManager streams, Map json) { | 24 VMIsolateRef newVMIsolateRef(rpc.Peer peer, StreamManager streams, Map json) { |
24 if (json == null) return null; | 25 if (json == null) return null; |
25 assert(json["type"] == "@Isolate" || json["type"] == "Isolate"); | 26 assert(json["type"] == "@Isolate" || json["type"] == "Isolate"); |
26 var scope = new Scope(peer, streams, json["id"]); | 27 var scope = new Scope(peer, streams, json["id"]); |
27 return new VMIsolateRef._(scope, json); | 28 return new VMIsolateRef._(scope, json); |
28 } | 29 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 /// | 336 /// |
336 /// This is supported as of VM service version 3.1, or Dart SDK version 1.14. | 337 /// 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]) { | 338 Future<Object> invokeExtension(String method, [Map<String, String> params]) { |
338 if (!method.startsWith('ext.')) { | 339 if (!method.startsWith('ext.')) { |
339 throw new ArgumentError.value(method, 'method', | 340 throw new ArgumentError.value(method, 'method', |
340 'must begin with "ext." prefix'); | 341 'must begin with "ext." prefix'); |
341 } | 342 } |
342 return _scope.sendRequest(method, params); | 343 return _scope.sendRequest(method, params); |
343 } | 344 } |
344 | 345 |
346 /// Generates a report of code coverage information and possible break points | |
347 /// for the scripts in this isolate. | |
348 /// | |
349 /// If [includeCoverageReport] is `true`, the report includes code coverage | |
350 /// information via [VMSourceReportRange.hits] and | |
351 /// [VMSourceReportRange.misses] in | |
352 /// [VMSourceReport.ranges]. | |
353 /// Otherwise, [VMSourceReportRange.coverage] is `null`. | |
354 /// | |
355 /// If [includePossibleBreakpoints] is `true`, the report includes a list of | |
356 /// token positions which correspond to possible breakpoints via | |
357 /// [VMSourceReportRange.possibleBreakpoints] in [VMSourceReport.ranges]. | |
358 /// Otherwise, [VMSourceReportRange.possibleBreakpoints] is `null`. | |
359 /// | |
360 /// If [forceCompile] is `true`, all functions in the range of the report | |
361 /// will be compiled. | |
362 /// Forcing compilation can cause a compilation error, which could terminate | |
363 /// the running Dart program. | |
kevmoo
2016/04/29 23:36:56
still need to do this...
kevmoo
2016/05/03 22:34:50
Done.
| |
364 Future<VMSourceReport> getSourceReport( | |
365 {bool includeCoverageReport: false, | |
366 bool includePossibleBreakpoints: false, | |
367 bool forceCompile: false}) async { | |
368 var reports = <String>[]; | |
369 if (includeCoverageReport) { | |
370 reports.add('Coverage'); | |
371 } | |
372 | |
373 if (includePossibleBreakpoints) { | |
374 reports.add('PossibleBreakpoints'); | |
375 } | |
376 | |
377 var params = {'reports': reports}; | |
378 if (forceCompile) { | |
379 params['forceCompile'] = true; | |
380 } | |
381 | |
382 var json = await _scope.sendRequest('getSourceReport', params); | |
383 return newSourceReport(_scope, json); | |
384 } | |
385 | |
345 bool operator ==(other) => other is VMIsolateRef && | 386 bool operator ==(other) => other is VMIsolateRef && |
346 other._scope.isolateId == _scope.isolateId; | 387 other._scope.isolateId == _scope.isolateId; |
347 | 388 |
348 int get hashCode => _scope.isolateId.hashCode; | 389 int get hashCode => _scope.isolateId.hashCode; |
349 | 390 |
350 String toString() => name; | 391 String toString() => name; |
351 } | 392 } |
352 | 393 |
353 /// A full isolate on the remote VM. | 394 /// A full isolate on the remote VM. |
354 class VMIsolate extends VMIsolateRef { | 395 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. | 502 /// The kind, which identifies the type of event and its source. |
462 final String kind; | 503 final String kind; |
463 | 504 |
464 /// The event's payload. | 505 /// The event's payload. |
465 final Map data; | 506 final Map data; |
466 | 507 |
467 VMExtensionEvent._(Map json) | 508 VMExtensionEvent._(Map json) |
468 : kind = json['extensionKind'], | 509 : kind = json['extensionKind'], |
469 data = json['extensionData']; | 510 data = json['extensionData']; |
470 } | 511 } |
OLD | NEW |