| 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_ref_element; | 5 library service_ref_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:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 10 import 'observatory_element.dart'; | 10 import 'observatory_element.dart'; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 element.ref = ref; | 95 element.ref = ref; |
| 96 return element; | 96 return element; |
| 97 case 'Object': | 97 case 'Object': |
| 98 ServiceRefElement element = new Element.tag('object-ref'); | 98 ServiceRefElement element = new Element.tag('object-ref'); |
| 99 element.ref = ref; | 99 element.ref = ref; |
| 100 return element; | 100 return element; |
| 101 case 'Script': | 101 case 'Script': |
| 102 ServiceRefElement element = new Element.tag('script-ref'); | 102 ServiceRefElement element = new Element.tag('script-ref'); |
| 103 element.ref = ref; | 103 element.ref = ref; |
| 104 return element; | 104 return element; |
| 105 case 'Instance': |
| 106 case 'Sentinel': |
| 107 ServiceRefElement element = new Element.tag('instance-ref'); |
| 108 element.ref = ref; |
| 109 return element; |
| 105 default: | 110 default: |
| 106 if (ref.isInstance || | 111 SpanElement element = new Element.tag('span'); |
| 107 ref.isSentinel) { // TODO(rmacnak): Separate this out. | 112 element.text = "<<Unknown service ref: $ref>>"; |
| 108 ServiceRefElement element = new Element.tag('instance-ref'); | 113 return element; |
| 109 element.ref = ref; | |
| 110 return element; | |
| 111 } else { | |
| 112 SpanElement element = new Element.tag('span'); | |
| 113 element.text = "<<Unknown service ref: $ref>>"; | |
| 114 return element; | |
| 115 } | |
| 116 } | 114 } |
| 117 } | 115 } |
| 118 | 116 |
| 119 refChanged(oldValue) { | 117 refChanged(oldValue) { |
| 120 // Remove the current view. | 118 // Remove the current view. |
| 121 children.clear(); | 119 children.clear(); |
| 122 if (ref == null) { | 120 if (ref == null) { |
| 123 Logger.root.info('Viewing null object.'); | 121 Logger.root.info('Viewing null object.'); |
| 124 return; | 122 return; |
| 125 } | 123 } |
| 126 var type = ref.vmType; | 124 var type = ref.vmType; |
| 127 var element = _constructElementForRef(); | 125 var element = _constructElementForRef(); |
| 128 if (element == null) { | 126 if (element == null) { |
| 129 Logger.root.info('Unable to find a ref element for \'${type}\''); | 127 Logger.root.info('Unable to find a ref element for \'${type}\''); |
| 130 return; | 128 return; |
| 131 } | 129 } |
| 132 children.add(element); | 130 children.add(element); |
| 133 } | 131 } |
| 134 } | 132 } |
| 135 | 133 |
| 136 @CustomTag('object-ref') | 134 @CustomTag('object-ref') |
| 137 class ObjectRefElement extends ServiceRefElement { | 135 class ObjectRefElement extends ServiceRefElement { |
| 138 ObjectRefElement.created() : super.created(); | 136 ObjectRefElement.created() : super.created(); |
| 139 } | 137 } |
| OLD | NEW |