Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: lib/src/isolate.dart

Issue 1929063002: pkg/vm_service_client: add getSourceReport to VMServiceReference (Closed) Base URL: https://github.com/dart-lang/vm_service_client.git@master
Patch Set: tweak Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 [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. If `false`, functions that are never used may not appear
362 /// in [VMSourceReportRange.misses].
363 /// Forcing compilation can cause a compilation error, which could terminate
364 /// the running Dart program.
365 Future<VMSourceReport> getSourceReport(
366 {bool includeCoverageReport: true,
367 bool includePossibleBreakpoints: true,
368 bool forceCompile: false}) async {
369 var reports = <String>[];
370 if (includeCoverageReport) reports.add('Coverage');
371 if (includePossibleBreakpoints) reports.add('PossibleBreakpoints');
372
373 var params = {'reports': reports};
374 if (forceCompile) params['forceCompile'] = true;
375
376 var json = await _scope.sendRequest('getSourceReport', params);
377 return newSourceReport(_scope, json);
378 }
379
346 bool operator ==(other) => other is VMIsolateRef && 380 bool operator ==(other) => other is VMIsolateRef &&
347 other._scope.isolateId == _scope.isolateId; 381 other._scope.isolateId == _scope.isolateId;
348 382
349 int get hashCode => _scope.isolateId.hashCode; 383 int get hashCode => _scope.isolateId.hashCode;
350 384
351 String toString() => name; 385 String toString() => name;
352 } 386 }
353 387
354 /// A full isolate on the remote VM. 388 /// A full isolate on the remote VM.
355 class VMIsolate extends VMIsolateRef { 389 class VMIsolate extends VMIsolateRef {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 /// The kind, which identifies the type of event and its source. 495 /// The kind, which identifies the type of event and its source.
462 final String kind; 496 final String kind;
463 497
464 /// The event's payload. 498 /// The event's payload.
465 final Map data; 499 final Map data;
466 500
467 VMExtensionEvent._(Map json) 501 VMExtensionEvent._(Map json)
468 : kind = json['extensionKind'], 502 : kind = json['extensionKind'],
469 data = json['extensionData']; 503 data = json['extensionData'];
470 } 504 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/script.dart » ('j') | lib/src/source_report.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698