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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 /// | 337 /// |
337 /// 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. |
338 Future<Object> invokeExtension(String method, [Map<String, String> params]) { | 339 Future<Object> invokeExtension(String method, [Map<String, String> params]) { |
339 if (!method.startsWith('ext.')) { | 340 if (!method.startsWith('ext.')) { |
340 throw new ArgumentError.value(method, 'method', | 341 throw new ArgumentError.value(method, 'method', |
341 'must begin with "ext." prefix'); | 342 'must begin with "ext." prefix'); |
342 } | 343 } |
343 return _scope.sendRequest(method, params); | 344 return _scope.sendRequest(method, params); |
344 } | 345 } |
345 | 346 |
347 /// Generates a report of code coverage information and possible break points | |
348 /// for the scripts in this isolate. | |
349 /// | |
350 /// If [includeCoverageReport] is `true`, the report includes code coverage | |
351 /// information via [VMSourceReportRange.hits] and | |
352 /// [VMSourceReportRange.misses] in | |
353 /// [VMSourceReport.ranges]. | |
354 /// Otherwise, [VMSourceReportRange.coverage] is `null`. | |
nweiz
2016/05/04 23:05:51
Reflow this text so there isn't unnecessary whites
kevmoo
2016/05/05 20:46:26
Done – mostly.
I like to start new sentences on n
nweiz
2016/05/11 23:03:31
That's contrary to the style elsewhere in this pac
kevmoo
2016/05/12 05:22:34
Markdown ignores single-line breaks – so no humans
| |
355 /// | |
356 /// If [includePossibleBreakpoints] is `true`, the report includes a list of | |
357 /// token positions which correspond to possible breakpoints via | |
358 /// [VMSourceReportRange.possibleBreakpoints] in [VMSourceReport.ranges]. | |
359 /// Otherwise, [VMSourceReportRange.possibleBreakpoints] is `null`. | |
360 /// | |
361 /// If [forceCompile] is `true`, all functions in the range of the report | |
362 /// will be compiled. If `false`, functions that are never used may not appear | |
363 /// in [VMSourceReportRange.misses]. | |
364 /// Forcing compilation can cause a compilation error, which could terminate | |
365 /// the running Dart program. | |
366 Future<VMSourceReport> getSourceReport( | |
367 {bool includeCoverageReport: false, | |
368 bool includePossibleBreakpoints: false, | |
nweiz
2016/05/04 23:05:51
It doesn't seem particularly useful to have the so
kevmoo
2016/05/05 20:46:26
Done.
| |
369 bool forceCompile: false}) async { | |
370 var reports = <String>[]; | |
371 if (includeCoverageReport) { | |
372 reports.add('Coverage'); | |
373 } | |
374 | |
375 if (includePossibleBreakpoints) { | |
376 reports.add('PossibleBreakpoints'); | |
377 } | |
378 | |
379 var params = {'reports': reports}; | |
380 if (forceCompile) { | |
381 params['forceCompile'] = true; | |
382 } | |
nweiz
2016/05/04 23:05:51
Good thing you tested this! :D
kevmoo
2016/05/05 20:46:26
Acknowledged.
| |
383 | |
384 var json = await _scope.sendRequest('getSourceReport', params); | |
385 return newSourceReport(_scope, json); | |
386 } | |
387 | |
346 bool operator ==(other) => other is VMIsolateRef && | 388 bool operator ==(other) => other is VMIsolateRef && |
347 other._scope.isolateId == _scope.isolateId; | 389 other._scope.isolateId == _scope.isolateId; |
348 | 390 |
349 int get hashCode => _scope.isolateId.hashCode; | 391 int get hashCode => _scope.isolateId.hashCode; |
350 | 392 |
351 String toString() => name; | 393 String toString() => name; |
352 } | 394 } |
353 | 395 |
354 /// A full isolate on the remote VM. | 396 /// A full isolate on the remote VM. |
355 class VMIsolate extends VMIsolateRef { | 397 class VMIsolate extends VMIsolateRef { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 /// The kind, which identifies the type of event and its source. | 503 /// The kind, which identifies the type of event and its source. |
462 final String kind; | 504 final String kind; |
463 | 505 |
464 /// The event's payload. | 506 /// The event's payload. |
465 final Map data; | 507 final Map data; |
466 | 508 |
467 VMExtensionEvent._(Map json) | 509 VMExtensionEvent._(Map json) |
468 : kind = json['extensionKind'], | 510 : kind = json['extensionKind'], |
469 data = json['extensionData']; | 511 data = json['extensionData']; |
470 } | 512 } |
OLD | NEW |