| 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 service_object_view_element; | 5 library service_object_view_element; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:logging/logging.dart'; | 8 import 'package:logging/logging.dart'; |
| 9 import 'package:observatory/service.dart'; | 9 import 'package:observatory/service.dart'; |
| 10 import 'package:observatory/elements.dart'; | 10 import 'package:observatory/elements.dart'; |
| 11 import 'package:polymer/polymer.dart'; | 11 import 'package:polymer/polymer.dart'; |
| 12 import 'observatory_element.dart'; | 12 import 'observatory_element.dart'; |
| 13 | 13 |
| 14 @CustomTag('service-view') | 14 @CustomTag('service-view') |
| 15 class ServiceObjectViewElement extends ObservatoryElement { | 15 class ServiceObjectViewElement extends ObservatoryElement { |
| 16 @published ServiceObject object; | 16 @published ServiceObject object; |
| 17 @published ObservableMap args; |
| 17 | 18 |
| 18 ServiceObjectViewElement.created() : super.created(); | 19 ServiceObjectViewElement.created() : super.created(); |
| 19 | 20 |
| 20 ObservatoryElement _constructElementForObject() { | 21 ObservatoryElement _constructElementForObject() { |
| 21 var type = object.serviceType; | 22 var type = object.serviceType; |
| 22 switch (type) { | 23 switch (type) { |
| 23 case 'AllocationProfile': | 24 case 'AllocationProfile': |
| 24 HeapProfileElement element = new Element.tag('heap-profile'); | 25 HeapProfileElement element = new Element.tag('heap-profile'); |
| 25 element.profile = object; | 26 element.profile = object; |
| 26 return element; | 27 return element; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if (object == null) { | 195 if (object == null) { |
| 195 Logger.root.info('Viewing null object.'); | 196 Logger.root.info('Viewing null object.'); |
| 196 return; | 197 return; |
| 197 } | 198 } |
| 198 var type = object.serviceType; | 199 var type = object.serviceType; |
| 199 var element = _constructElementForObject(); | 200 var element = _constructElementForObject(); |
| 200 if (element == null) { | 201 if (element == null) { |
| 201 Logger.root.info('Unable to find a view element for \'${type}\''); | 202 Logger.root.info('Unable to find a view element for \'${type}\''); |
| 202 return; | 203 return; |
| 203 } | 204 } |
| 205 element.args = args; |
| 204 children.add(element); | 206 children.add(element); |
| 205 Logger.root.info('Viewing object of \'${type}\''); | 207 Logger.root.info('Viewing object of \'${type}\''); |
| 206 } | 208 } |
| 207 } | 209 } |
| OLD | NEW |