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

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

Issue 119673004: Version 1.1.0-dev.5.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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: dart/runtime/bin/vmservice/client/lib/src/observatory/location_manager.dart
===================================================================
--- dart/runtime/bin/vmservice/client/lib/src/observatory/location_manager.dart (revision 31530)
+++ dart/runtime/bin/vmservice/client/lib/src/observatory/location_manager.dart (working copy)
@@ -10,11 +10,14 @@
class LocationManager extends Observable {
static const int InvalidIsolateId = 0;
static const String defaultHash = '#/isolates/';
- static final RegExp currentIsolateMatcher = new RegExp(r"#/isolates/\d+/");
+ static final RegExp currentIsolateMatcher = new RegExp(r"#/isolates/\d+");
+ static final RegExp currentIsolateProfileMatcher =
+ new RegExp(r'#/isolates/\d+/profile');
ObservatoryApplication _application;
ObservatoryApplication get application => _application;
+ @observable bool profile = false;
@observable String currentHash = '';
@observable Uri currentHashUri;
void init() {
@@ -48,24 +51,15 @@
return currentIsolateAnchorPrefix() != null;
}
- bool get isScriptLink {
- String type = currentHashUri.queryParameters['type'];
- return type == 'Script';
- }
-
- String get scriptName {
- return Uri.decodeQueryComponent(currentHashUri.queryParameters['name']);
- }
-
/// Extract the current isolate id as an integer. Returns [InvalidIsolateId]
/// if none is present in window.location.
- int currentIsolateId() {
- String isolatePrefix = currentIsolateAnchorPrefix();
- if (isolatePrefix == null) {
- return InvalidIsolateId;
+ String currentIsolateId() {
+ var prefix = currentIsolateAnchorPrefix();
+ if (prefix == null) {
+ return '';
}
- String id = isolatePrefix.split("/")[2];
- return int.parse(id);
+ // Chop off the '/#'.
+ return prefix.substring(2);
}
/// If no anchor is set, set the default anchor and return true.
@@ -86,7 +80,12 @@
// Chomp off the #
String requestUrl = currentHash.substring(1);
currentHashUri = Uri.parse(requestUrl);
- application.requestManager.get(requestUrl);
+ if (currentIsolateProfileMatcher.hasMatch(currentHash)) {
+ // We do not automatically fetch profile data.
+ profile = true;
+ } else {
+ application.requestManager.get(requestUrl);
+ }
}
/// Create a request for [l] on the current isolate.
@@ -99,59 +98,16 @@
return relativeLink(isolateId, l);
}
- /// Create a request for [objectId] on the current isolate.
+ /// Create a request for [scriptURL] on the current isolate.
@observable
- String currentIsolateObjectLink(int objectId) {
- var isolateId = currentIsolateId();
- if (isolateId == LocationManager.InvalidIsolateId) {
- return defaultHash;
- }
- return objectLink(isolateId, objectId);
+ String currentIsolateScriptLink(String scriptURL) {
+ var encoded = Uri.encodeComponent(scriptURL);
+ return currentIsolateRelativeLink('scripts/$encoded');
}
- /// Create a request for [cid] on the current isolate.
- @observable
- String currentIsolateClassLink(int cid) {
- var isolateId = currentIsolateId();
- if (isolateId == LocationManager.InvalidIsolateId) {
- return defaultHash;
- }
- return classLink(isolateId, cid);
- }
-
- /// Create a request for the script [objectId] with script [name].
- @observable
- String currentIsolateScriptLink(int objectId, String name) {
- var isolateId = currentIsolateId();
- if (isolateId == LocationManager.InvalidIsolateId) {
- return defaultHash;
- }
- return scriptLink(isolateId, objectId, name);
- }
-
/// Create a request for [l] on [isolateId].
@observable
- String relativeLink(int isolateId, String l) {
- return '#/isolates/$isolateId/$l';
+ String relativeLink(String isolateId, String l) {
+ return '#/$isolateId/$l';
}
-
- /// Create a request for [objectId] on [isolateId].
- @observable
- String objectLink(int isolateId, int objectId) {
- return '#/isolates/$isolateId/objects/$objectId';
- }
-
- /// Create a request for [cid] on [isolateId].
- @observable
- String classLink(int isolateId, int cid) {
- return '#/isolates/$isolateId/classes/$cid';
- }
-
- @observable
- /// Create a request for the script [objectId] with script [url].
- String scriptLink(int isolateId, int objectId, String name) {
- String encodedName = Uri.encodeQueryComponent(name);
- return '#/isolates/$isolateId/objects/$objectId'
- '?type=Script&name=$encodedName';
- }
}

Powered by Google App Engine
This is Rietveld 408576698