| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 String get name { | 47 String get name { |
| 48 if (ref == null) { | 48 if (ref == null) { |
| 49 return 'NULL REF'; | 49 return 'NULL REF'; |
| 50 } | 50 } |
| 51 return ref.name; | 51 return ref.name; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Workaround isEmpty not being useable due to missing @MirrorsUsed. | 54 // Workaround isEmpty not being useable due to missing @MirrorsUsed. |
| 55 bool get nameIsEmpty { | 55 bool get nameIsEmpty { |
| 56 return name.isEmpty; | 56 return (name == null) || name.isEmpty; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 @CustomTag('any-service-ref') | 61 @CustomTag('any-service-ref') |
| 62 class AnyServiceRefElement extends ObservatoryElement { | 62 class AnyServiceRefElement extends ObservatoryElement { |
| 63 @published ServiceObject ref; | 63 @published ServiceObject ref; |
| 64 AnyServiceRefElement.created() : super.created(); | 64 AnyServiceRefElement.created() : super.created(); |
| 65 | 65 |
| 66 Element _constructElementForRef() { | 66 Element _constructElementForRef() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 87 element.ref = ref; | 87 element.ref = ref; |
| 88 return element; | 88 return element; |
| 89 case 'Function': | 89 case 'Function': |
| 90 ServiceRefElement element = new Element.tag('function-ref'); | 90 ServiceRefElement element = new Element.tag('function-ref'); |
| 91 element.ref = ref; | 91 element.ref = ref; |
| 92 return element; | 92 return element; |
| 93 case 'Library': | 93 case 'Library': |
| 94 ServiceRefElement element = new Element.tag('library-ref'); | 94 ServiceRefElement element = new Element.tag('library-ref'); |
| 95 element.ref = ref; | 95 element.ref = ref; |
| 96 return element; | 96 return element; |
| 97 case 'Object': |
| 98 ServiceRefElement element = new Element.tag('object-ref'); |
| 99 element.ref = ref; |
| 100 return element; |
| 101 case 'Script': |
| 102 ServiceRefElement element = new Element.tag('script-ref'); |
| 103 element.ref = ref; |
| 104 return element; |
| 97 default: | 105 default: |
| 98 if (ref.isInstance || | 106 if (ref.isInstance || |
| 99 ref.isSentinel) { // TODO(rmacnak): Separate this out. | 107 ref.isSentinel) { // TODO(rmacnak): Separate this out. |
| 100 ServiceRefElement element = new Element.tag('instance-ref'); | 108 ServiceRefElement element = new Element.tag('instance-ref'); |
| 101 element.ref = ref; | 109 element.ref = ref; |
| 102 return element; | 110 return element; |
| 103 } else { | 111 } else { |
| 104 SpanElement element = new Element.tag('span'); | 112 SpanElement element = new Element.tag('span'); |
| 105 element.text = "<<Unknown service ref: $ref>>"; | 113 element.text = "<<Unknown service ref: $ref>>"; |
| 106 return element; | 114 return element; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 118 var type = ref.vmType; | 126 var type = ref.vmType; |
| 119 var element = _constructElementForRef(); | 127 var element = _constructElementForRef(); |
| 120 if (element == null) { | 128 if (element == null) { |
| 121 Logger.root.info('Unable to find a ref element for \'${type}\''); | 129 Logger.root.info('Unable to find a ref element for \'${type}\''); |
| 122 return; | 130 return; |
| 123 } | 131 } |
| 124 children.add(element); | 132 children.add(element); |
| 125 Logger.root.info('Viewing object of \'${type}\''); | 133 Logger.root.info('Viewing object of \'${type}\''); |
| 126 } | 134 } |
| 127 } | 135 } |
| 136 |
| 137 @CustomTag('object-ref') |
| 138 class ObjectRefElement extends ServiceRefElement { |
| 139 ObjectRefElement.created() : super.created(); |
| 140 } |
| OLD | NEW |