| Index: runtime/bin/vmservice/client/lib/src/app/location_manager.dart
|
| diff --git a/runtime/bin/vmservice/client/lib/src/observatory/location_manager.dart b/runtime/bin/vmservice/client/lib/src/app/location_manager.dart
|
| similarity index 68%
|
| rename from runtime/bin/vmservice/client/lib/src/observatory/location_manager.dart
|
| rename to runtime/bin/vmservice/client/lib/src/app/location_manager.dart
|
| index 2b7c4098e3637754b4172f6461b1897f41f6fc67..29fc0747ac44e91c002897e5f20614edaf9bded4 100644
|
| --- a/runtime/bin/vmservice/client/lib/src/observatory/location_manager.dart
|
| +++ b/runtime/bin/vmservice/client/lib/src/app/location_manager.dart
|
| @@ -2,7 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -part of observatory;
|
| +part of app;
|
|
|
| /// The LocationManager class observes and parses the hash ('#') portion of the
|
| /// URL in window.location. The text after the '#' is used as the request
|
| @@ -11,11 +11,9 @@ 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 currentIsolateProfileMatcher =
|
| - new RegExp(r'#/isolates/\d+/profile');
|
|
|
| - ObservatoryApplication _application;
|
| - ObservatoryApplication get application => _application;
|
| + ObservatoryApplication _app;
|
| + ObservatoryApplication get app => _app;
|
|
|
| @observable bool profile = false;
|
| @observable String currentHash = '';
|
| @@ -49,6 +47,15 @@ class LocationManager extends Observable {
|
| return m.input.substring(m.start, m.end);
|
| }
|
|
|
| + /// Returns the current object id.
|
| + String currentObjectId() {
|
| + Match m = currentIsolateMatcher.matchAsPrefix(currentHash);
|
| + if (m == null) {
|
| + return null;
|
| + }
|
| + return m.input.substring(m.end);
|
| + }
|
| +
|
| /// Predicate, does the current URL have a current isolate ID in it?
|
| @observable bool get hasCurrentIsolate {
|
| return currentIsolateAnchorPrefix() != null;
|
| @@ -65,12 +72,13 @@ class LocationManager extends Observable {
|
| return prefix.substring(2);
|
| }
|
|
|
| + /// Returns the current isolate.
|
| @observable Isolate currentIsolate() {
|
| var id = currentIsolateId();
|
| if (id == '') {
|
| return null;
|
| }
|
| - return _application.isolateManager.getIsolate(id);
|
| + return app.vm.getIsolate(id);
|
| }
|
|
|
| /// If no anchor is set, set the default anchor and return true.
|
| @@ -90,42 +98,17 @@ class LocationManager extends Observable {
|
| currentHash = window.location.hash;
|
| // Chomp off the #
|
| String requestUrl = currentHash.substring(1);
|
| + app.isolate = currentIsolate();
|
| currentHashUri = Uri.parse(requestUrl);
|
| - if (currentIsolateProfileMatcher.hasMatch(currentHash)) {
|
| - // We do not automatically fetch profile data.
|
| - profile = true;
|
| - } else {
|
| - application.requestManager.get(requestUrl);
|
| - profile = false;
|
| - }
|
| - }
|
| -
|
| - /// Create a request for [l] on the current isolate.
|
| - @observable
|
| - String currentIsolateRelativeLink(String l) {
|
| - var isolateId = currentIsolateId();
|
| - if (isolateId == LocationManager.InvalidIsolateId) {
|
| - return defaultHash;
|
| + if (app.isolate == null) {
|
| + Logger.root.warning('Refreshing isolates.');
|
| + app.vm.refreshIsolates();
|
| + return;
|
| }
|
| - return relativeLink(isolateId, l);
|
| - }
|
| -
|
| - /// Create a request for [scriptURL] on the current isolate.
|
| - @observable
|
| - String currentIsolateScriptLink(String scriptURL) {
|
| - var encoded = Uri.encodeComponent(scriptURL);
|
| - return currentIsolateRelativeLink('scripts/$encoded');
|
| - }
|
| -
|
| - /// Create a request for [l] on [isolateId].
|
| - @observable
|
| - String relativeLink(String isolateId, String l) {
|
| - return '#/$isolateId/$l';
|
| - }
|
| -
|
| - /// Create a request for [l] on [isolateId].
|
| - @observable
|
| - String absoluteLink(String l) {
|
| - return '#/$l';
|
| + var objectId = currentObjectId();
|
| + Logger.root.info('Asking ${app.isolate.id} for ${objectId}');
|
| + app.isolate.get(objectId).then((so) {
|
| + app.response = so;
|
| + });
|
| }
|
| }
|
|
|