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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/service/object.dart

Issue 271153002: Add pause/resume for isolates in vmservice/observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 part of service; 5 part of service;
6 6
7 /// A [ServiceObject] is an object known to the VM service and is tied 7 /// A [ServiceObject] is an object known to the VM service and is tied
8 /// to an owning [Isolate]. 8 /// to an owning [Isolate].
9 abstract class ServiceObject extends Observable { 9 abstract class ServiceObject extends Observable {
10 /// The owner of this [ServiceObject]. This can be an [Isolate], a 10 /// The owner of this [ServiceObject]. This can be an [Isolate], a
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 if (snapshots.length > _historySize) { 453 if (snapshots.length > _historySize) {
454 snapshots.removeAt(0); 454 snapshots.removeAt(0);
455 } 455 }
456 } 456 }
457 } 457 }
458 458
459 /// State for a running isolate. 459 /// State for a running isolate.
460 class Isolate extends ServiceObjectOwner { 460 class Isolate extends ServiceObjectOwner {
461 @reflectable VM get vm => owner; 461 @reflectable VM get vm => owner;
462 @reflectable Isolate get isolate => this; 462 @reflectable Isolate get isolate => this;
463 @observable ObservableMap counters = toObservable(new ObservableMap()); 463 @observable ObservableMap counters = new ObservableMap();
464 464
465 String get link => _id; 465 String get link => _id;
466 String get hashLink => '#/$_id'; 466 String get hashLink => '#/$_id';
467 467
468 @observable bool pausedOnStart = false; 468 @observable ServiceMap pauseEvent = null;
469 @observable bool pausedOnExit = false; 469 bool get _isPaused => pauseEvent != null;
470
470 @observable bool running = false; 471 @observable bool running = false;
471 @observable bool idle = false; 472 @observable bool idle = false;
473 @observable bool loading = true;
472 474
473 Map<String,ServiceObject> _cache = new Map<String,ServiceObject>(); 475 Map<String,ServiceObject> _cache = new Map<String,ServiceObject>();
474 final TagProfile tagProfile = new TagProfile(20); 476 final TagProfile tagProfile = new TagProfile(20);
475 477
476 Isolate._empty(ServiceObjectOwner owner) : super._empty(owner) { 478 Isolate._empty(ServiceObjectOwner owner) : super._empty(owner) {
477 assert(owner is VM); 479 assert(owner is VM);
478 } 480 }
479 481
480 /// Creates a link to [id] relative to [this]. 482 /// Creates a link to [id] relative to [this].
481 @reflectable String relativeLink(String id) => '${this.id}/$id'; 483 @reflectable String relativeLink(String id) => '${this.id}/$id';
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 @observable DartError error; 605 @observable DartError error;
604 606
605 void _update(ObservableMap map, bool mapIsRef) { 607 void _update(ObservableMap map, bool mapIsRef) {
606 mainPort = map['mainPort']; 608 mainPort = map['mainPort'];
607 name = map['name']; 609 name = map['name'];
608 vmName = map['name']; 610 vmName = map['name'];
609 if (mapIsRef) { 611 if (mapIsRef) {
610 return; 612 return;
611 } 613 }
612 _loaded = true; 614 _loaded = true;
615 loading = false;
Cutch 2014/05/12 17:57:08 Would be nice to generalize this for all ServiceOb
613 _upgradeCollection(map, isolate); 616 _upgradeCollection(map, isolate);
614 if (map['rootLib'] == null || 617 if (map['rootLib'] == null ||
615 map['timers'] == null || 618 map['timers'] == null ||
616 map['heap'] == null) { 619 map['heap'] == null) {
617 Logger.root.severe("Malformed 'Isolate' response: $map"); 620 Logger.root.severe("Malformed 'Isolate' response: $map");
618 return; 621 return;
619 } 622 }
620 rootLib = map['rootLib']; 623 rootLib = map['rootLib'];
621 if (map['entry'] != null) { 624 if (map['entry'] != null) {
622 entry = map['entry']; 625 entry = map['entry'];
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 timerMap['time_isolate_initialization'] + 664 timerMap['time_isolate_initialization'] +
662 timerMap['time_bootstrap']); 665 timerMap['time_bootstrap']);
663 timers['dart'] = timerMap['time_dart_execution']; 666 timers['dart'] = timerMap['time_dart_execution'];
664 667
665 newHeapUsed = map['heap']['usedNew']; 668 newHeapUsed = map['heap']['usedNew'];
666 oldHeapUsed = map['heap']['usedOld']; 669 oldHeapUsed = map['heap']['usedOld'];
667 newHeapCapacity = map['heap']['capacityNew']; 670 newHeapCapacity = map['heap']['capacityNew'];
668 oldHeapCapacity = map['heap']['capacityOld']; 671 oldHeapCapacity = map['heap']['capacityOld'];
669 672
670 // Isolate status 673 // Isolate status
671 pausedOnStart = map['pausedOnStart']; 674 pauseEvent = map['pauseEvent'];
672 pausedOnExit = map['pausedOnExit']; 675 running = (!_isPaused && map['topFrame'] != null);
673 running = map['topFrame'] != null; 676 idle = (!_isPaused && map['topFrame'] == null);
674 idle = !pausedOnStart && !pausedOnExit && !running;
675 error = map['error']; 677 error = map['error'];
676 678
677 libraries.clear(); 679 libraries.clear();
678 for (var lib in map['libraries']) { 680 for (var lib in map['libraries']) {
679 libraries.add(lib); 681 libraries.add(lib);
680 } 682 }
681 libraries.sort((a,b) => a.name.compareTo(b.name)); 683 libraries.sort((a,b) => a.name.compareTo(b.name));
682 } 684 }
683 685
684 Future<TagProfile> updateTagProfile() { 686 Future<TagProfile> updateTagProfile() {
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 var v = list[i]; 1478 var v = list[i];
1477 if ((v is ObservableMap) && _isServiceMap(v)) { 1479 if ((v is ObservableMap) && _isServiceMap(v)) {
1478 list[i] = owner.getFromMap(v); 1480 list[i] = owner.getFromMap(v);
1479 } else if (v is ObservableList) { 1481 } else if (v is ObservableList) {
1480 _upgradeObservableList(v, owner); 1482 _upgradeObservableList(v, owner);
1481 } else if (v is ObservableMap) { 1483 } else if (v is ObservableMap) {
1482 _upgradeObservableMap(v, owner); 1484 _upgradeObservableMap(v, owner);
1483 } 1485 }
1484 } 1486 }
1485 } 1487 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698