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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory/isolate.dart

Issue 185413015: Update the navbar in the observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: new js Created 6 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 observatory; 5 part of observatory;
6 6
7 7
8 /// State for a running isolate. 8 /// State for a running isolate.
9 class Isolate extends Observable { 9 class Isolate extends Observable {
10 static ObservatoryApplication _application; 10 static ObservatoryApplication _application;
11 11
12 @observable Profile profile; 12 @observable Profile profile;
13 @observable final Map<String, Script> scripts = 13 @observable final Map<String, Script> scripts =
14 toObservable(new Map<String, Script>()); 14 toObservable(new Map<String, Script>());
15 @observable final List<Code> codes = new List<Code>(); 15 @observable final List<Code> codes = new List<Code>();
16 @observable String id; 16 @observable String id;
17 @observable String name; 17 @observable String name;
18 @observable String vmName;
18 @observable Map entry; 19 @observable Map entry;
19 @observable String rootLib; 20 @observable String rootLib;
20 @observable final Map<String, double> timers = 21 @observable final Map<String, double> timers =
21 toObservable(new Map<String, double>()); 22 toObservable(new Map<String, double>());
22 23
23 @observable int newHeapUsed = 0; 24 @observable int newHeapUsed = 0;
24 @observable int oldHeapUsed = 0; 25 @observable int oldHeapUsed = 0;
25 26
26 @observable Map topFrame = null; 27 @observable Map topFrame = null;
27 @observable String fileAndLine = null; 28 @observable String fileAndLine = null;
28 29
29 Isolate.fromId(this.id) : name = '' {} 30 Isolate.fromId(this.id) : name = 'isolate' {}
30 31
31 Isolate.fromMap(Map map) 32 Isolate.fromMap(Map map)
32 : id = map['id'], name = map['name'] { 33 : id = map['id'], name = map['name'] {
33 } 34 }
34 35
35 void refresh() { 36 Future refresh() {
36 var request = '/$id/'; 37 var request = '/$id/';
37 _application.requestManager.requestMap(request).then((map) { 38 return _application.requestManager.requestMap(request).then((map) {
38 update(map); 39 update(map);
39 }).catchError((e, trace) { 40 }).catchError((e, trace) {
40 Logger.root.severe('Error while updating isolate summary: $e\n$trace') ; 41 Logger.root.severe('Error while updating isolate summary: $e\n$trace' );
41 }); 42 });
42 } 43 }
43 44
44 void update(Map map) { 45 void update(Map map) {
45 if (map['type'] != 'Isolate') { 46 if (map['type'] != 'Isolate') {
46 Logger.root.severe('Unexpected message type in Isolate.update: ${map["type "]}'); 47 Logger.root.severe('Unexpected message type in Isolate.update: ${map["type "]}');
47 return; 48 return;
48 } 49 }
49 if (map['name'] == null || 50 if (map['rootLib'] == null ||
50 map['rootLib'] == null ||
51 map['timers'] == null || 51 map['timers'] == null ||
52 map['heap'] == null) { 52 map['heap'] == null) {
53 Logger.root.severe("Malformed 'Isolate' response: $map"); 53 Logger.root.severe("Malformed 'Isolate' response: $map");
54 return; 54 return;
55 } 55 }
56 name = map['name'];
57 rootLib = map['rootLib']['id']; 56 rootLib = map['rootLib']['id'];
57 vmName = map['name'];
58 if (map['entry'] != null) { 58 if (map['entry'] != null) {
59 entry = map['entry']; 59 entry = map['entry'];
60 name = entry['name'];
61 } else {
62 // fred
63 name = 'root isolate';
60 } 64 }
61 if (map['topFrame'] != null) { 65 if (map['topFrame'] != null) {
62 topFrame = map['topFrame']; 66 topFrame = map['topFrame'];
63 } 67 }
64 68
65 var timerMap = {}; 69 var timerMap = {};
66 map['timers'].forEach((timer) { 70 map['timers'].forEach((timer) {
67 timerMap[timer['name']] = timer['time']; 71 timerMap[timer['name']] = timer['time'];
68 }); 72 });
69 timers['total'] = timerMap['time_total_runtime']; 73 timers['total'] = timerMap['time_total_runtime'];
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 var script = scripts[id]; 116 var script = scripts[id];
113 if (script == null) { 117 if (script == null) {
114 script = new Script.fromMap(coverage['script']); 118 script = new Script.fromMap(coverage['script']);
115 scripts[id] = script; 119 scripts[id] = script;
116 } 120 }
117 assert(script != null); 121 assert(script != null);
118 script._processCoverageHits(coverage['hits']); 122 script._processCoverageHits(coverage['hits']);
119 } 123 }
120 } 124 }
121 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698