Index: runtime/bin/vmservice/client/lib/src/elements/isolate_summary.dart |
diff --git a/runtime/bin/vmservice/client/lib/src/elements/isolate_summary.dart b/runtime/bin/vmservice/client/lib/src/elements/isolate_summary.dart |
index 56baabf4989eac6d049c8870dedf070d4d5424f1..7054ba18b5c549cf77f36e62bcfe44e7b43cc93d 100644 |
--- a/runtime/bin/vmservice/client/lib/src/elements/isolate_summary.dart |
+++ b/runtime/bin/vmservice/client/lib/src/elements/isolate_summary.dart |
@@ -4,12 +4,104 @@ |
library isolate_summary_element; |
+import 'dart:async'; |
+import 'dart:html'; |
+import 'observatory_element.dart'; |
+import 'package:observatory/app.dart'; |
import 'package:observatory/service.dart'; |
+import 'package:logging/logging.dart'; |
import 'package:polymer/polymer.dart'; |
-import 'observatory_element.dart'; |
@CustomTag('isolate-summary') |
class IsolateSummaryElement extends ObservatoryElement { |
IsolateSummaryElement.created() : super.created(); |
+ |
+ @published Isolate isolate; |
+} |
+ |
+@CustomTag('isolate-run-state') |
+class IsolateRunStateElement extends ObservatoryElement { |
+ IsolateRunStateElement.created() : super.created(); |
+ |
+ @published Isolate isolate; |
+ |
+ Future pause(_) { |
+ return isolate.get("debug/pause").then((result) { |
+ // TODO(turnidge): Instead of asserting here, handle errors |
+ // properly. |
+ assert(result.serviceType == 'Success'); |
+ return isolate.reload(); |
+ }); |
+ } |
+ |
+ Future resume(_) { |
+ return isolate.get("debug/resume").then((result) { |
+ // TODO(turnidge): Instead of asserting here, handle errors |
+ // properly. |
+ assert(result.serviceType == 'Success'); |
+ return isolate.reload(); |
+ }); |
+ } |
+} |
+ |
+@CustomTag('isolate-location') |
+class IsolateLocationElement extends ObservatoryElement { |
+ IsolateLocationElement.created() : super.created(); |
+ |
+ @published Isolate isolate; |
+} |
+ |
+@CustomTag('isolate-shared-summary') |
+class IsolateSharedSummaryElement extends ObservatoryElement { |
+ IsolateSharedSummaryElement.created() : super.created(); |
+ |
@published Isolate isolate; |
} |
+ |
+class CounterChart { |
+ var _table = new DataTable(); |
+ var _chart; |
+ |
+ void update(Map counters) { |
+ if (_table.columns == 0) { |
+ // Initialize. |
+ _table.addColumn('string', 'Name'); |
+ _table.addColumn('number', 'Value'); |
+ } |
+ _table.clearRows(); |
+ for (var key in counters.keys) { |
+ var value = double.parse(counters[key].split('%')[0]); |
+ _table.addRow([key, value]); |
+ } |
+ } |
+ |
+ void draw(var element) { |
+ if (_chart == null) { |
+ assert(element != null); |
+ _chart = new Chart('PieChart', element); |
+ } |
+ _chart.draw(_table); |
+ } |
+} |
+ |
+@CustomTag('isolate-counter-chart') |
+class IsolateCounterChartElement extends ObservatoryElement { |
+ IsolateCounterChartElement.created() : super.created(); |
+ |
+ @published ObservableMap counters; |
+ CounterChart chart = new CounterChart(); |
+ |
+ void countersChanged(oldValue) { |
+ if (counters == null) { |
+ return; |
+ } |
+ chart.update(counters); |
+ var element = shadowRoot.querySelector('#counterPieChart'); |
+ if (element != null) { |
+ chart.draw(element); |
+ } |
+ } |
+} |
+ |
+ |
+ |