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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory/location_manager.dart

Issue 50243002: Extend Observatory to display libraries, classes, fields, functions and code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 part of observatory; 5 part of observatory;
6 6
7 /// The LocationManager class observes and parses the hash ('#') portion of the 7 /// The LocationManager class observes and parses the hash ('#') portion of the
8 /// URL in window.location. The text after the '#' is used as the request 8 /// URL in window.location. The text after the '#' is used as the request
9 /// string for the VM service. 9 /// string for the VM service.
10 class LocationManager extends Object with ChangeNotifierMixin { 10 class LocationManager extends Observable {
11 static const int InvalidIsolateId = 0; 11 static const int InvalidIsolateId = 0;
12 static const String defaultHash = '#/isolates/'; 12 static const String defaultHash = '#/isolates/';
13 static final RegExp currentIsolateMatcher = new RegExp(r"#/isolates/\d+/"); 13 static final RegExp currentIsolateMatcher = new RegExp(r"#/isolates/\d+/");
14 14
15 ObservatoryApplication _application; 15 ObservatoryApplication _application;
16 ObservatoryApplication get application => _application; 16 ObservatoryApplication get application => _application;
17 17
18 @observable String get currentHash => __$currentHash; String __$currentHash = ''; set currentHash(String value) { __$currentHash = notifyPropertyChange(#curre ntHash, __$currentHash, value); } 18 @observable String currentHash = '';
19 19
20 void init() { 20 void init() {
21 window.onHashChange.listen((event) { 21 window.onHashChange.listen((event) {
22 if (setDefaultHash()) { 22 if (setDefaultHash()) {
23 // We just triggered another onHashChange event. 23 // We just triggered another onHashChange event.
24 return; 24 return;
25 } 25 }
26 // Request the current anchor. 26 // Request the current anchor.
27 requestCurrentHash(); 27 requestCurrentHash();
28 }); 28 });
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 /// Take the current request string from window.location and submit the 73 /// Take the current request string from window.location and submit the
74 /// request to the request manager. 74 /// request to the request manager.
75 void requestCurrentHash() { 75 void requestCurrentHash() {
76 currentHash = window.location.hash; 76 currentHash = window.location.hash;
77 // Chomp off the # 77 // Chomp off the #
78 String requestUrl = currentHash.substring(1); 78 String requestUrl = currentHash.substring(1);
79 application.requestManager.get(requestUrl); 79 application.requestManager.get(requestUrl);
80 } 80 }
81 81
82 /// Create a request for [l] on the current isolate. 82 /// Create a request for [l] on the current isolate.
83 @observable
83 String currentIsolateRelativeLink(String l) { 84 String currentIsolateRelativeLink(String l) {
84 var isolateId = currentIsolateId(); 85 var isolateId = currentIsolateId();
85 if (isolateId == LocationManager.InvalidIsolateId) { 86 if (isolateId == LocationManager.InvalidIsolateId) {
86 return defaultHash; 87 return defaultHash;
87 } 88 }
88 return relativeLink(isolateId, l); 89 return relativeLink(isolateId, l);
89 } 90 }
90 91
91 /// Create a request for [objectId] on the current isolate. 92 /// Create a request for [objectId] on the current isolate.
93 @observable
92 String currentIsolateObjectLink(int objectId) { 94 String currentIsolateObjectLink(int objectId) {
93 var isolateId = currentIsolateId(); 95 var isolateId = currentIsolateId();
94 if (isolateId == LocationManager.InvalidIsolateId) { 96 if (isolateId == LocationManager.InvalidIsolateId) {
95 return defaultHash; 97 return defaultHash;
96 } 98 }
97 return objectLink(isolateId, objectId); 99 return objectLink(isolateId, objectId);
98 } 100 }
99 101
100 /// Create a request for [cid] on the current isolate. 102 /// Create a request for [cid] on the current isolate.
103 @observable
101 String currentIsolateClassLink(int cid) { 104 String currentIsolateClassLink(int cid) {
102 var isolateId = currentIsolateId(); 105 var isolateId = currentIsolateId();
103 if (isolateId == LocationManager.InvalidIsolateId) { 106 if (isolateId == LocationManager.InvalidIsolateId) {
104 return defaultHash; 107 return defaultHash;
105 } 108 }
106 return classLink(isolateId, cid); 109 return classLink(isolateId, cid);
107 } 110 }
108 111
109 /// Create a request for [l] on [isolateId]. 112 /// Create a request for [l] on [isolateId].
113 @observable
110 String relativeLink(int isolateId, String l) { 114 String relativeLink(int isolateId, String l) {
111 return '#/isolates/$isolateId/$l'; 115 return '#/isolates/$isolateId/$l';
112 } 116 }
113 117
114 /// Create a request for [objectId] on [isolateId]. 118 /// Create a request for [objectId] on [isolateId].
119 @observable
115 String objectLink(int isolateId, int objectId) { 120 String objectLink(int isolateId, int objectId) {
116 return '#/isolates/$isolateId/objects/$objectId'; 121 return '#/isolates/$isolateId/objects/$objectId';
117 } 122 }
118 123
119 /// Create a request for [cid] on [isolateId]. 124 /// Create a request for [cid] on [isolateId].
125 @observable
120 String classLink(int isolateId, int cid) { 126 String classLink(int isolateId, int cid) {
121 return '#/isolates/$isolateId/classes/$cid'; 127 return '#/isolates/$isolateId/classes/$cid';
122 } 128 }
123 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698