| Index: runtime/bin/vmservice/client/lib/src/app/pane.dart
|
| diff --git a/runtime/bin/vmservice/client/lib/src/app/application.dart b/runtime/bin/vmservice/client/lib/src/app/pane.dart
|
| similarity index 53%
|
| copy from runtime/bin/vmservice/client/lib/src/app/application.dart
|
| copy to runtime/bin/vmservice/client/lib/src/app/pane.dart
|
| index 183d6b18a77eeb3d0d240d1a3765691699ba8282..e99906417672657c97e5ab6957f43b543453f98c 100644
|
| --- a/runtime/bin/vmservice/client/lib/src/app/application.dart
|
| +++ b/runtime/bin/vmservice/client/lib/src/app/pane.dart
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2014, 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.
|
|
|
| @@ -55,6 +55,8 @@ class ServiceObjectPane extends Pane {
|
| app.vm.get(url).then((obj) {
|
| ServiceObjectViewElement pane = element;
|
| pane.object = obj;
|
| + }).catchError((e) {
|
| + Logger.root.severe('ServiceObjectPane visit error: $e');
|
| });
|
| }
|
|
|
| @@ -87,6 +89,8 @@ class ClassTreePane extends Pane {
|
| ClassTreeElement pane = element;
|
| pane.isolate = i;
|
| }
|
| + }).catchError((e) {
|
| + Logger.root.severe('ClassTreePane visit error: $e');
|
| });
|
| }
|
|
|
| @@ -113,95 +117,20 @@ class ErrorViewPane extends Pane {
|
| bool canVisit(String url) => url.startsWith('error/');
|
| }
|
|
|
| -/// The observatory application. Instances of this are created and owned
|
| -/// by the observatory_application custom element.
|
| -class ObservatoryApplication extends Observable {
|
| - final _paneRegistry = new List<Pane>();
|
| - ServiceObjectPane _serviceObjectPane;
|
| - Pane _currentPane;
|
| - @observable final LocationManager locationManager;
|
| - @observable final VM vm;
|
| - @observable Isolate isolate;
|
| - @reflectable final ObservatoryApplicationElement rootElement;
|
| -
|
| - @reflectable ServiceObject lastErrorOrException;
|
| -
|
| - void _initOnce() {
|
| - _registerPanes();
|
| - vm.errors.stream.listen(_onError);
|
| - vm.exceptions.stream.listen(_onException);
|
| - location = locationManager;
|
| - locationManager._init(this);
|
| - }
|
| -
|
| - void _registerPanes() {
|
| - if (_serviceObjectPane != null) {
|
| - // Already done.
|
| - return;
|
| - }
|
| - // Register ClassTreePane.
|
| - _paneRegistry.add(new ClassTreePane(this));
|
| - _paneRegistry.add(new ErrorViewPane(this));
|
| - // Note that ServiceObjectPane must be the last entry in the list as it is
|
| - // the catch all.
|
| - _serviceObjectPane = new ServiceObjectPane(this);
|
| - _paneRegistry.add(_serviceObjectPane);
|
| - }
|
| -
|
| - void _onError(ServiceError error) {
|
| - lastErrorOrException = error;
|
| - _visit('error/', null);
|
| - }
|
| -
|
| - void _onException(ServiceException exception) {
|
| - lastErrorOrException = exception;
|
| - _visit('error/', null);
|
| - }
|
| +class VMConnectPane extends Pane {
|
| + VMConnectPane(app) : super(app);
|
|
|
| - void _visit(String url, String args) {
|
| - // TODO(johnmccutchan): Pass [args] to pane.
|
| - for (var i = 0; i < _paneRegistry.length; i++) {
|
| - var pane = _paneRegistry[i];
|
| - if (pane.canVisit(url)) {
|
| - _installPane(pane);
|
| - pane.visit(url);
|
| - return;
|
| - }
|
| - }
|
| - throw new FallThroughError();
|
| - }
|
| -
|
| - /// Set the Observatory application pane.
|
| - void _installPane(Pane pane) {
|
| - assert(pane != null);
|
| - print('Installing $pane');
|
| - if (_currentPane == pane) {
|
| - // Already isntalled.
|
| - return;
|
| - }
|
| - if (_currentPane != null) {
|
| - _currentPane.onUninstall();
|
| + void onInstall() {
|
| + if (element == null) {
|
| + element = new Element.tag('vm-connect');
|
| }
|
| - pane.onInstall();
|
| - // Clear children.
|
| - rootElement.children.clear();
|
| - // Add new pane.
|
| - rootElement.children.add(pane.element);
|
| - // Remember pane.
|
| - _currentPane = pane;
|
| + assert(element != null);
|
| }
|
|
|
| - ObservatoryApplication.devtools(this.rootElement) :
|
| - locationManager = new HashLocationManager(),
|
| - vm = new DartiumVM() {
|
| - _initOnce();
|
| + void visit(String url) {
|
| + assert(element != null);
|
| + assert(canVisit(url));
|
| }
|
|
|
| - ObservatoryApplication(this.rootElement) :
|
| - locationManager = new HashLocationManager(),
|
| - vm = new HttpVM() {
|
| - _initOnce();
|
| - }
|
| + bool canVisit(String url) => url.startsWith('vm-connect/');
|
| }
|
| -
|
| -LocationManager location;
|
|
|