| Index: runtime/bin/vmservice/client/packages/observatory/src/observatory/location_manager.dart
|
| diff --git a/runtime/bin/vmservice/client/packages/observatory/src/observatory/location_manager.dart b/runtime/bin/vmservice/client/packages/observatory/src/observatory/location_manager.dart
|
| deleted file mode 100644
|
| index f9272e3b1628b67d9b7963fde970c50934b02b00..0000000000000000000000000000000000000000
|
| --- a/runtime/bin/vmservice/client/packages/observatory/src/observatory/location_manager.dart
|
| +++ /dev/null
|
| @@ -1,123 +0,0 @@
|
| -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| -// 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;
|
| -
|
| -/// The LocationManager class observes and parses the hash ('#') portion of the
|
| -/// URL in window.location. The text after the '#' is used as the request
|
| -/// string for the VM service.
|
| -class LocationManager extends Object with ChangeNotifierMixin {
|
| - static const int InvalidIsolateId = 0;
|
| - static const String defaultHash = '#/isolates/';
|
| - static final RegExp currentIsolateMatcher = new RegExp(r"#/isolates/\d+/");
|
| -
|
| - ObservatoryApplication _application;
|
| - ObservatoryApplication get application => _application;
|
| -
|
| - @observable String get currentHash => __$currentHash; String __$currentHash = ''; set currentHash(String value) { __$currentHash = notifyPropertyChange(#currentHash, __$currentHash, value); }
|
| -
|
| - void init() {
|
| - window.onHashChange.listen((event) {
|
| - if (setDefaultHash()) {
|
| - // We just triggered another onHashChange event.
|
| - return;
|
| - }
|
| - // Request the current anchor.
|
| - requestCurrentHash();
|
| - });
|
| -
|
| - if (!setDefaultHash()) {
|
| - // An anchor was already present, trigger a request.
|
| - requestCurrentHash();
|
| - }
|
| - }
|
| -
|
| - /// Returns the current isolate prefix, i.e. '#/isolates/XX/' if one
|
| - /// is present and null otherwise.
|
| - String currentIsolateAnchorPrefix() {
|
| - Match m = currentIsolateMatcher.matchAsPrefix(currentHash);
|
| - if (m == null) {
|
| - return null;
|
| - }
|
| - return m.input.substring(m.start, m.end);
|
| - }
|
| -
|
| - /// Predicate, does the current URL have a current isolate ID in it?
|
| - bool get hasCurrentIsolate {
|
| - return currentIsolateAnchorPrefix() != null;
|
| - }
|
| -
|
| - /// 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 id = isolatePrefix.split("/")[2];
|
| - return int.parse(id);
|
| - }
|
| -
|
| - /// If no anchor is set, set the default anchor and return true.
|
| - /// Return false otherwise.
|
| - bool setDefaultHash() {
|
| - currentHash = window.location.hash;
|
| - if (currentHash == '' || currentHash == '#') {
|
| - window.location.hash = defaultHash;
|
| - return true;
|
| - }
|
| - return false;
|
| - }
|
| -
|
| - /// Take the current request string from window.location and submit the
|
| - /// request to the request manager.
|
| - void requestCurrentHash() {
|
| - currentHash = window.location.hash;
|
| - // Chomp off the #
|
| - String requestUrl = currentHash.substring(1);
|
| - application.requestManager.get(requestUrl);
|
| - }
|
| -
|
| - /// Create a request for [l] on the current isolate.
|
| - String currentIsolateRelativeLink(String l) {
|
| - var isolateId = currentIsolateId();
|
| - if (isolateId == LocationManager.InvalidIsolateId) {
|
| - return defaultHash;
|
| - }
|
| - return relativeLink(isolateId, l);
|
| - }
|
| -
|
| - /// Create a request for [objectId] on the current isolate.
|
| - String currentIsolateObjectLink(int objectId) {
|
| - var isolateId = currentIsolateId();
|
| - if (isolateId == LocationManager.InvalidIsolateId) {
|
| - return defaultHash;
|
| - }
|
| - return objectLink(isolateId, objectId);
|
| - }
|
| -
|
| - /// Create a request for [cid] on the current isolate.
|
| - String currentIsolateClassLink(int cid) {
|
| - var isolateId = currentIsolateId();
|
| - if (isolateId == LocationManager.InvalidIsolateId) {
|
| - return defaultHash;
|
| - }
|
| - return classLink(isolateId, cid);
|
| - }
|
| -
|
| - /// Create a request for [l] on [isolateId].
|
| - String relativeLink(int isolateId, String l) {
|
| - return '#/isolates/$isolateId/$l';
|
| - }
|
| -
|
| - /// Create a request for [objectId] on [isolateId].
|
| - String objectLink(int isolateId, int objectId) {
|
| - return '#/isolates/$isolateId/objects/$objectId';
|
| - }
|
| -
|
| - /// Create a request for [cid] on [isolateId].
|
| - String classLink(int isolateId, int cid) {
|
| - return '#/isolates/$isolateId/classes/$cid';
|
| - }
|
| -}
|
|
|