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

Side by Side Diff: runtime/observatory/lib/src/elements/observatory_element.dart

Issue 928833003: Add Function based profile tree (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 observatory_element; 5 library observatory_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:observatory/app.dart'; 9 import 'package:observatory/app.dart';
10 import 'package:observatory/service.dart'; 10 import 'package:observatory/service.dart';
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 _stopPoll(); 81 _stopPoll();
82 return; 82 return;
83 } 83 }
84 // Restart timer. 84 // Restart timer.
85 _pollTimer = new Timer(pollPeriod, _onPoll); 85 _pollTimer = new Timer(pollPeriod, _onPoll);
86 } 86 }
87 87
88 /// Utility method for handling on-click of <a> tags. Navigates 88 /// Utility method for handling on-click of <a> tags. Navigates
89 /// within the application using the [LocationManager]. 89 /// within the application using the [LocationManager].
90 void goto(MouseEvent event, var detail, Element target) { 90 void goto(MouseEvent event, var detail, Element target) {
91 app.locationManager.onGoto(event, detail, target); 91 app.locationManager.onGoto(event);
92 event.stopPropagation(); 92 event.stopPropagation();
93 } 93 }
94 94
95 void onClickGoto(MouseEvent event) {
96 app.locationManager.onGoto(event);
97 event.stopPropagation();
98 }
99
95 String makeLink(String url, [ServiceObject obj]) { 100 String makeLink(String url, [ServiceObject obj]) {
96 if (obj != null) { 101 if (obj != null) {
97 if (obj is Isolate) { 102 if (obj is Isolate) {
98 url = '${url}?isolateId=${Uri.encodeComponent(obj.id)}'; 103 url = '${url}?isolateId=${Uri.encodeComponent(obj.id)}';
99 } else { 104 } else {
105 if (obj.id == null) {
106 // No id
107 return url;
108 }
100 url = ('${url}?isolateId=${Uri.encodeComponent(obj.isolate.id)}' 109 url = ('${url}?isolateId=${Uri.encodeComponent(obj.isolate.id)}'
101 '&objectId=${Uri.encodeComponent(obj.id)}'); 110 '&objectId=${Uri.encodeComponent(obj.id)}');
102 } 111 }
103 } 112 }
104 return url; 113 return url;
105 } 114 }
106 115
107 /// Create a link that can be consumed by [goto]. 116 /// Create a link that can be consumed by [goto].
108 String gotoLink(String url, [ServiceObject obj]) { 117 String gotoLink(String url, [ServiceObject obj]) {
109 return app.locationManager.makeLink(makeLink(url, obj)); 118 return app.locationManager.makeLink(makeLink(url, obj));
110 } 119 }
111 120
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 result.addAll(escapeSequence.codeUnits); 153 result.addAll(escapeSequence.codeUnits);
145 } else result.add(codeUnit); 154 } else result.add(codeUnit);
146 } 155 }
147 if (wasTruncated) { 156 if (wasTruncated) {
148 result.addAll("...".codeUnits); 157 result.addAll("...".codeUnits);
149 } else { 158 } else {
150 result.add("'".codeUnitAt(0)); 159 result.add("'".codeUnitAt(0));
151 } 160 }
152 return new String.fromCharCodes(result); 161 return new String.fromCharCodes(result);
153 } 162 }
163
164 void clearShadowRoot() {
165 // Remove all non-style elements.
166 shadowRoot.children.removeWhere((e) => e is! StyleElement);
167 }
168
169 void insertTextSpanIntoShadowRoot(String text) {
170 var spanElement = new SpanElement();
171 spanElement.text = text;
172 shadowRoot.children.add(spanElement);
173 }
174
175 void insertLinkIntoShadowRoot(String label, String href, [String title]) {
176 var anchorElement = new AnchorElement();
177 anchorElement.href = href;
178 anchorElement.text = label;
179 if (title != null) {
180 anchorElement.title = title;
181 }
182 anchorElement.onClick.listen(onClickGoto);
183 shadowRoot.children.add(anchorElement);
184 }
154 } 185 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/heap_profile.dart ('k') | runtime/observatory/lib/src/elements/script_ref.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698