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

Unified Diff: runtime/bin/vmservice/client/lib/src/observatory_elements/script_ref.dart

Issue 165643003: Rework <script-ref>: - optional 'line' parameter - use a shorter version of the script url in the a… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/vmservice/client/lib/src/observatory_elements/script_ref.dart
diff --git a/runtime/bin/vmservice/client/lib/src/observatory_elements/script_ref.dart b/runtime/bin/vmservice/client/lib/src/observatory_elements/script_ref.dart
index bf6e00bcbe9b8bb49206291ead35440156f63588..05bf87ab45106ebbef52a3a813b1d87c759456b3 100644
--- a/runtime/bin/vmservice/client/lib/src/observatory_elements/script_ref.dart
+++ b/runtime/bin/vmservice/client/lib/src/observatory_elements/script_ref.dart
@@ -9,5 +9,43 @@ import 'service_ref.dart';
@CustomTag('script-ref')
class ScriptRefElement extends ServiceRefElement {
+ @published int line = -1;
+
+ String get url {
+ if ((app != null) && (ref != null)) {
+ var baseUrl = relativeLink(ref['id']);
+ if (line < 0) {
+ return baseUrl;
+ } else {
+ return '$baseUrl?line=$line';
+ }
+ }
+ return '';
+ }
+
+ String get hoverText {
+ if (ref == null) {
+ return '';
+ }
+ if (line < 0) {
+ return ref['user_name'];
+ } else {
+ return "${ref['user_name']}:$line";
+ }
+ }
+
+ String get name {
+ if (ref == null) {
+ return '';
+ }
+ var scriptUrl = ref['user_name'];
+ var shortScriptUrl = scriptUrl.substring(scriptUrl.lastIndexOf('/') + 1);
+ if (line < 0) {
+ return shortScriptUrl;
+ } else {
+ return "$shortScriptUrl:$line";
+ }
+ }
+
ScriptRefElement.created() : super.created();
}

Powered by Google App Engine
This is Rietveld 408576698