| 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 library metrics; | 5 library metrics; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 7 import 'dart:html'; | 8 import 'dart:html'; |
| 8 import 'observatory_element.dart'; | 9 import 'observatory_element.dart'; |
| 9 import 'package:observatory/app.dart'; | 10 import 'package:observatory/app.dart'; |
| 10 import 'package:observatory/service.dart'; | 11 import 'package:observatory/service.dart'; |
| 11 import 'package:polymer/polymer.dart'; | 12 import 'package:polymer/polymer.dart'; |
| 12 | 13 |
| 13 @CustomTag('metrics-page') | 14 @CustomTag('metrics-page') |
| 14 class MetricsPageElement extends ObservatoryElement { | 15 class MetricsPageElement extends ObservatoryElement { |
| 15 MetricsPageElement.created() : super.created(); | 16 MetricsPageElement.created() : super.created(); |
| 16 | 17 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 44 } | 45 } |
| 45 | 46 |
| 46 void isolateChanged(oldValue) { | 47 void isolateChanged(oldValue) { |
| 47 if (isolate != null) { | 48 if (isolate != null) { |
| 48 isolate.refreshMetrics().then((_) { | 49 isolate.refreshMetrics().then((_) { |
| 49 _autoPickSelectedMetric(); | 50 _autoPickSelectedMetric(); |
| 50 }); | 51 }); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 void refresh(var done) { | 55 Future refresh() { |
| 55 isolate.refreshMetrics().whenComplete(done); | 56 return isolate.refreshMetrics(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void selectMetric(Event e, var detail, Element target) { | 59 void selectMetric(Event e, var detail, Element target) { |
| 59 String id = target.attributes['data-id']; | 60 String id = target.attributes['data-id']; |
| 60 selectedMetric = isolate.dartMetrics[id]; | 61 selectedMetric = isolate.dartMetrics[id]; |
| 61 if (selectedMetric == null) { | 62 if (selectedMetric == null) { |
| 62 // Check VM metrics. | 63 // Check VM metrics. |
| 63 selectedMetric = isolate.nativeMetrics[id]; | 64 selectedMetric = isolate.nativeMetrics[id]; |
| 64 } | 65 } |
| 65 if (selectedMetric != null) { | 66 if (selectedMetric != null) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 var sample = metric.samples[i]; | 189 var sample = metric.samples[i]; |
| 189 _table.addTimeOfDayValue(sample.time, sample.value); | 190 _table.addTimeOfDayValue(sample.time, sample.value); |
| 190 } | 191 } |
| 191 } | 192 } |
| 192 | 193 |
| 193 metricChanged(oldValue) { | 194 metricChanged(oldValue) { |
| 194 if (oldValue != metric) { | 195 if (oldValue != metric) { |
| 195 _setupInitialDataTable(); | 196 _setupInitialDataTable(); |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 } | 199 } |
| OLD | NEW |