| OLD | NEW |
| 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 library dart.vmstats; | 5 library dart.vmstats; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:json' as JSON; | 9 import 'dart:json' as JSON; |
| 10 | 10 |
| 11 part 'bargraph.dart'; | 11 part 'bargraph.dart'; |
| 12 part 'isolate_list.dart'; | 12 part 'isolate_list.dart'; |
| 13 part 'models.dart'; | 13 part 'models.dart'; |
| 14 | 14 |
| 15 BarGraph _graph; | 15 BarGraph _graph; |
| 16 IsolateList _isolateList; | 16 IsolateList _isolateList; |
| 17 DivElement _statusText; | 17 DivElement _statusText; |
| 18 IsolateListModel _isolates; | 18 IsolateListModel _isolates; |
| 19 Timer _updater; | 19 Timer _updater; |
| 20 | 20 |
| 21 final int _POLL_INTERVAL = const Duration(seconds: 1); | 21 final int _POLL_INTERVAL = const Duration(seconds: 3); |
| 22 final String CYAN = '#00EE76'; | 22 final String CYAN = '#00EE76'; |
| 23 final String GREEN = '#97FFFF'; | 23 final String GREEN = '#97FFFF'; |
| 24 | 24 |
| 25 void main() { | 25 void main() { |
| 26 DivElement dashBoard = query('#dashboard'); | 26 DivElement dashBoard = query('#dashboard'); |
| 27 CanvasElement canvas = query('#graph'); | 27 CanvasElement canvas = query('#graph'); |
| 28 var elements = [ new Element("Old Space", GREEN), | 28 var elements = [ new Element("Old Space", GREEN), |
| 29 new Element("New Space", CYAN)]; | 29 new Element("New Space", CYAN)]; |
| 30 _graph = new BarGraph(canvas, elements); | 30 _graph = new BarGraph(canvas, elements); |
| 31 _isolateList = new IsolateList(query('#isolateList')); | 31 _isolateList = new IsolateList(query('#isolateList')); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 51 | 51 |
| 52 void onRequestFailed() { | 52 void onRequestFailed() { |
| 53 _updater.cancel(); | 53 _updater.cancel(); |
| 54 _isolates.removeListener(onUpdateStatus); | 54 _isolates.removeListener(onUpdateStatus); |
| 55 showStatus('Server closed'); | 55 showStatus('Server closed'); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void showStatus(status) { | 58 void showStatus(status) { |
| 59 _statusText.text = status; | 59 _statusText.text = status; |
| 60 } | 60 } |
| OLD | NEW |