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

Side by Side Diff: runtime/bin/vmstats/isolate_list.dart

Issue 12377099: Added support for "bin-ified" vmstats web app source files (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
(Empty)
1 part of vmstats;
siva 2013/03/05 23:12:44 Copyright and ditto comment about adding a qualifi
srdjan 2013/03/05 23:17:30 Add Copyright
Tom Ball 2013/03/06 00:34:43 Done.
Tom Ball 2013/03/06 00:34:43 Done.
2
3 class IsolateList {
4 UListElement _listArea;
5
6 final String CSS_VISIBLE = 'isolate_details';
7 final String CSS_HIDDEN = 'isolate_details_hidden';
srdjan 2013/03/05 23:17:30 static const
Tom Ball 2013/03/06 00:34:43 Done.
8
9 IsolateList(UListElement area) {
srdjan 2013/03/05 23:17:30 this._area
Tom Ball 2013/03/06 00:34:43 Done.
10 _listArea = area;
11 }
siva 2013/03/05 23:12:44 IsolateList(this._listArea);
Tom Ball 2013/03/06 00:34:43 Done.
12
13 void updateList(IsolateListModel model) {
14 var detailsClass = CSS_HIDDEN;
15 if (_listArea.children.length > 0) {
16 // Preserve visibility state.
17 LIElement listItem = _listArea.children.first;
18 DivElement item = listItem.children.first;
19 if (item.classes.length > 0 && item.classes.first == CSS_VISIBLE) {
20 detailsClass = CSS_VISIBLE;
21 }
22 _listArea.children.clear();
23 }
24 Iterator<Isolate> iterator = model.iterator;
siva 2013/03/05 23:12:44 type not needed for local vars.
Tom Ball 2013/03/06 00:34:43 Done.
25 while (iterator.moveNext()) {
26 Isolate isolate = iterator.current;
27 LIElement listItem = new LIElement();
28 listItem.classes.add('isolate_list');
29 listItem.text = isolate.name
30 .replaceAll('\$', ': ') // Split script from isolate, and ...
31 .replaceAll('-', ' '); // ... split name from port number.
32
33 // Add isolate details as hidden children.
34 DivElement details = new DivElement();
35 isolateDetails(isolate, details);
36 details.classes.add(detailsClass);
37 listItem.children.add(details);
38 listItem.onClick.listen((e) => toggle(details));
39
40 _listArea.children.add(listItem);
41 }
42 }
43
44 void isolateDetails(Isolate isolate, DivElement parent) {
45 DivElement newSpace = new DivElement();
46 newSpace.text = 'New space: ${isolate.newSpace.used}K';
47 parent.children.add(newSpace);
48 DivElement oldSpace = new DivElement();
49 oldSpace.text = 'Old space: ${isolate.oldSpace.used}K';
50 parent.children.add(oldSpace);
51 DivElement stack = new DivElement();
52 stack.text = 'Stack limit: ${(isolate.stackLimit / 1000000).round()}M';
53 parent.children.add(stack);
siva 2013/03/05 23:12:44 Ditto comment about using types for local variable
Tom Ball 2013/03/06 00:34:43 Done.
54 }
55
56 void toggle(DivElement e) {
57 e.classes.toggle(CSS_VISIBLE);
58 e.classes.toggle(CSS_HIDDEN);
59 }
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698