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

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

Issue 897193002: Finish moving service protocol to json rpc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review 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:polymer/polymer.dart'; 11 import 'package:polymer/polymer.dart';
11 12
12 /// Base class for all Observatory custom elements. 13 /// Base class for all Observatory custom elements.
13 @CustomTag('observatory-element') 14 @CustomTag('observatory-element')
14 class ObservatoryElement extends PolymerElement { 15 class ObservatoryElement extends PolymerElement {
15 ObservatoryElement.created() : super.created(); 16 ObservatoryElement.created() : super.created();
16 17
17 ObservatoryApplication get app => ObservatoryApplication.app; 18 ObservatoryApplication get app => ObservatoryApplication.app;
18 Page get page => app.currentPage; 19 Page get page => app.currentPage;
19 ObservableMap get args => page.args; 20 ObservableMap get args => page.args;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 _pollTimer = new Timer(pollPeriod, _onPoll); 85 _pollTimer = new Timer(pollPeriod, _onPoll);
85 } 86 }
86 87
87 /// Utility method for handling on-click of <a> tags. Navigates 88 /// Utility method for handling on-click of <a> tags. Navigates
88 /// within the application using the [LocationManager]. 89 /// within the application using the [LocationManager].
89 void goto(MouseEvent event, var detail, Element target) { 90 void goto(MouseEvent event, var detail, Element target) {
90 app.locationManager.onGoto(event, detail, target); 91 app.locationManager.onGoto(event, detail, target);
91 event.stopPropagation(); 92 event.stopPropagation();
92 } 93 }
93 94
95 String makeLink(String url, [ServiceObject obj]) {
96 if (obj != null) {
97 if (obj is Isolate) {
98 url = '${url}?isolateId=${Uri.encodeComponent(obj.id)}';
99 } else {
100 url = ('${url}?isolateId=${Uri.encodeComponent(obj.isolate.id)}'
101 '&objectId=${Uri.encodeComponent(obj.id)}');
102 }
103 }
104 return url;
105 }
106
94 /// Create a link that can be consumed by [goto]. 107 /// Create a link that can be consumed by [goto].
95 String gotoLink(String url) { 108 String gotoLink(String url, [ServiceObject obj]) {
96 return app.locationManager.makeLink(url); 109 return app.locationManager.makeLink(makeLink(url, obj));
97 } 110 }
98 111
99 String formatTimePrecise(double time) => Utils.formatTimePrecise(time); 112 String formatTimePrecise(double time) => Utils.formatTimePrecise(time);
100 113
101 String formatTime(double time) => Utils.formatTime(time); 114 String formatTime(double time) => Utils.formatTime(time);
102 115
103 String formatSeconds(double x) => Utils.formatSeconds(x); 116 String formatSeconds(double x) => Utils.formatSeconds(x);
104 117
105 118
106 String formatSize(int bytes) => Utils.formatSize(bytes); 119 String formatSize(int bytes) => Utils.formatSize(bytes);
(...skipping 25 matching lines...) Expand all
132 } else result.add(codeUnit); 145 } else result.add(codeUnit);
133 } 146 }
134 if (wasTruncated) { 147 if (wasTruncated) {
135 result.addAll("...".codeUnits); 148 result.addAll("...".codeUnits);
136 } else { 149 } else {
137 result.add("'".codeUnitAt(0)); 150 result.add("'".codeUnitAt(0));
138 } 151 }
139 return new String.fromCharCodes(result); 152 return new String.fromCharCodes(result);
140 } 153 }
141 } 154 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav_bar.html ('k') | runtime/observatory/lib/src/elements/script_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698