Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: runtime/bin/vmservice/observatory/lib/src/elements/service_ref.dart

Issue 560503002: Add support for TokenStream, LocalVarDescriptors, and PcDescriptors to service lib and generic obje… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 'Script':
98 ServiceRefElement element = new Element.tag('script-ref');
99 element.ref = ref;
100 return element;
97 default: 101 default:
98 if (ref.isInstance || 102 if (ref.isInstance ||
99 ref.isSentinel) { // TODO(rmacnak): Separate this out. 103 ref.isSentinel) { // TODO(rmacnak): Separate this out.
100 ServiceRefElement element = new Element.tag('instance-ref'); 104 ServiceRefElement element = new Element.tag('instance-ref');
101 element.ref = ref; 105 element.ref = ref;
102 return element; 106 return element;
107 } else if (ref.isObject) {
turnidge 2014/09/09 19:30:25 I think this could be a switch in the case stateme
Cutch 2014/09/10 19:59:20 Done.
108 ServiceRefElement element = new Element.tag('object-ref');
109 element.ref = ref;
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;
107 } 115 }
108 } 116 }
109 } 117 }
110 118
111 refChanged(oldValue) { 119 refChanged(oldValue) {
112 // Remove the current view. 120 // Remove the current view.
113 children.clear(); 121 children.clear();
114 if (ref == null) { 122 if (ref == null) {
115 Logger.root.info('Viewing null object.'); 123 Logger.root.info('Viewing null object.');
116 return; 124 return;
117 } 125 }
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698