OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 @reflectable String get link => isolate.relativeLink(_id); | 30 @reflectable String get link => isolate.relativeLink(_id); |
31 | 31 |
32 /// The complete service url of this object with a '#/' prefix. | 32 /// The complete service url of this object with a '#/' prefix. |
33 // TODO(turnidge): Figure out why using a getter here messes up polymer. | 33 // TODO(turnidge): Figure out why using a getter here messes up polymer. |
34 @reflectable String get hashLink => '#/${link}'; | 34 @reflectable String get hashLink => '#/${link}'; |
35 @reflectable set hashLink(var o) { /* silence polymer */ } | 35 @reflectable set hashLink(var o) { /* silence polymer */ } |
36 | 36 |
37 /// Has this object been fully loaded? | 37 /// Has this object been fully loaded? |
38 bool get loaded => _loaded; | 38 bool get loaded => _loaded; |
39 bool _loaded = false; | 39 bool _loaded = false; |
| 40 // TODO(turnidge): Make loaded observable and get rid of loading |
| 41 // from Isolate. |
40 | 42 |
41 /// Is this object cacheable? That is, is it impossible for the [id] | 43 /// Is this object cacheable? That is, is it impossible for the [id] |
42 /// of this object to change? | 44 /// of this object to change? |
43 bool get canCache => false; | 45 bool get canCache => false; |
44 | 46 |
45 /// Is this object immutable after it is [loaded]? | 47 /// Is this object immutable after it is [loaded]? |
46 bool get immutable => false; | 48 bool get immutable => false; |
47 | 49 |
48 @observable String name; | 50 @observable String name; |
49 @observable String vmName; | 51 @observable String vmName; |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 if (snapshots.length > _historySize) { | 482 if (snapshots.length > _historySize) { |
481 snapshots.removeAt(0); | 483 snapshots.removeAt(0); |
482 } | 484 } |
483 } | 485 } |
484 } | 486 } |
485 | 487 |
486 /// State for a running isolate. | 488 /// State for a running isolate. |
487 class Isolate extends ServiceObjectOwner { | 489 class Isolate extends ServiceObjectOwner { |
488 @reflectable VM get vm => owner; | 490 @reflectable VM get vm => owner; |
489 @reflectable Isolate get isolate => this; | 491 @reflectable Isolate get isolate => this; |
490 @observable ObservableMap counters = toObservable(new ObservableMap()); | 492 @observable ObservableMap counters = new ObservableMap(); |
491 | 493 |
492 String get link => _id; | 494 String get link => _id; |
493 String get hashLink => '#/$_id'; | 495 String get hashLink => '#/$_id'; |
494 | 496 |
495 @observable bool pausedOnStart = false; | 497 @observable ServiceMap pauseEvent = null; |
496 @observable bool pausedOnExit = false; | 498 bool get _isPaused => pauseEvent != null; |
| 499 |
497 @observable bool running = false; | 500 @observable bool running = false; |
498 @observable bool idle = false; | 501 @observable bool idle = false; |
| 502 @observable bool loading = true; |
499 | 503 |
500 Map<String,ServiceObject> _cache = new Map<String,ServiceObject>(); | 504 Map<String,ServiceObject> _cache = new Map<String,ServiceObject>(); |
501 final TagProfile tagProfile = new TagProfile(20); | 505 final TagProfile tagProfile = new TagProfile(20); |
502 | 506 |
503 Isolate._empty(ServiceObjectOwner owner) : super._empty(owner) { | 507 Isolate._empty(ServiceObjectOwner owner) : super._empty(owner) { |
504 assert(owner is VM); | 508 assert(owner is VM); |
505 } | 509 } |
506 | 510 |
507 /// Creates a link to [id] relative to [this]. | 511 /// Creates a link to [id] relative to [this]. |
508 @reflectable String relativeLink(String id) => '${this.id}/$id'; | 512 @reflectable String relativeLink(String id) => '${this.id}/$id'; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 @observable DartError error; | 634 @observable DartError error; |
631 | 635 |
632 void _update(ObservableMap map, bool mapIsRef) { | 636 void _update(ObservableMap map, bool mapIsRef) { |
633 mainPort = map['mainPort']; | 637 mainPort = map['mainPort']; |
634 name = map['name']; | 638 name = map['name']; |
635 vmName = map['name']; | 639 vmName = map['name']; |
636 if (mapIsRef) { | 640 if (mapIsRef) { |
637 return; | 641 return; |
638 } | 642 } |
639 _loaded = true; | 643 _loaded = true; |
| 644 loading = false; |
640 _upgradeCollection(map, isolate); | 645 _upgradeCollection(map, isolate); |
641 if (map['rootLib'] == null || | 646 if (map['rootLib'] == null || |
642 map['timers'] == null || | 647 map['timers'] == null || |
643 map['heap'] == null) { | 648 map['heap'] == null) { |
644 Logger.root.severe("Malformed 'Isolate' response: $map"); | 649 Logger.root.severe("Malformed 'Isolate' response: $map"); |
645 return; | 650 return; |
646 } | 651 } |
647 rootLib = map['rootLib']; | 652 rootLib = map['rootLib']; |
648 if (map['entry'] != null) { | 653 if (map['entry'] != null) { |
649 entry = map['entry']; | 654 entry = map['entry']; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 timerMap['time_isolate_initialization'] + | 693 timerMap['time_isolate_initialization'] + |
689 timerMap['time_bootstrap']); | 694 timerMap['time_bootstrap']); |
690 timers['dart'] = timerMap['time_dart_execution']; | 695 timers['dart'] = timerMap['time_dart_execution']; |
691 | 696 |
692 newHeapUsed = map['heap']['usedNew']; | 697 newHeapUsed = map['heap']['usedNew']; |
693 oldHeapUsed = map['heap']['usedOld']; | 698 oldHeapUsed = map['heap']['usedOld']; |
694 newHeapCapacity = map['heap']['capacityNew']; | 699 newHeapCapacity = map['heap']['capacityNew']; |
695 oldHeapCapacity = map['heap']['capacityOld']; | 700 oldHeapCapacity = map['heap']['capacityOld']; |
696 | 701 |
697 // Isolate status | 702 // Isolate status |
698 pausedOnStart = map['pausedOnStart']; | 703 pauseEvent = map['pauseEvent']; |
699 pausedOnExit = map['pausedOnExit']; | 704 running = (!_isPaused && map['topFrame'] != null); |
700 running = map['topFrame'] != null; | 705 idle = (!_isPaused && map['topFrame'] == null); |
701 idle = !pausedOnStart && !pausedOnExit && !running; | |
702 error = map['error']; | 706 error = map['error']; |
703 | 707 |
704 libraries.clear(); | 708 libraries.clear(); |
705 for (var lib in map['libraries']) { | 709 for (var lib in map['libraries']) { |
706 libraries.add(lib); | 710 libraries.add(lib); |
707 } | 711 } |
708 libraries.sort((a,b) => a.name.compareTo(b.name)); | 712 libraries.sort((a,b) => a.name.compareTo(b.name)); |
709 } | 713 } |
710 | 714 |
711 Future<TagProfile> updateTagProfile() { | 715 Future<TagProfile> updateTagProfile() { |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 var v = list[i]; | 1507 var v = list[i]; |
1504 if ((v is ObservableMap) && _isServiceMap(v)) { | 1508 if ((v is ObservableMap) && _isServiceMap(v)) { |
1505 list[i] = owner.getFromMap(v); | 1509 list[i] = owner.getFromMap(v); |
1506 } else if (v is ObservableList) { | 1510 } else if (v is ObservableList) { |
1507 _upgradeObservableList(v, owner); | 1511 _upgradeObservableList(v, owner); |
1508 } else if (v is ObservableMap) { | 1512 } else if (v is ObservableMap) { |
1509 _upgradeObservableMap(v, owner); | 1513 _upgradeObservableMap(v, owner); |
1510 } | 1514 } |
1511 } | 1515 } |
1512 } | 1516 } |
OLD | NEW |