| Index: runtime/bin/vmservice/client/lib/src/service/vm.dart
|
| diff --git a/runtime/bin/vmservice/client/lib/src/service/vm.dart b/runtime/bin/vmservice/client/lib/src/service/vm.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8d4270929e88bf4c716c925e1e1c4107c7adbe6a
|
| --- /dev/null
|
| +++ b/runtime/bin/vmservice/client/lib/src/service/vm.dart
|
| @@ -0,0 +1,47 @@
|
| +// 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.
|
| +
|
| +part of service;
|
| +
|
| +abstract class VM extends Observable {
|
| + IsolateList _isolates;
|
| + @reflectable IsolateList get isolates => _isolates;
|
| +
|
| + void _initOnce() {
|
| + assert(_isolates == null);
|
| + _isolates = new IsolateList(this);
|
| + }
|
| +
|
| + VM() {
|
| + _initOnce();
|
| + }
|
| +
|
| + /// Get [id] as an [ObservableMap] from the service directly.
|
| + Future<ObservableMap> getAsMap(String id) {
|
| + return getString(id).then((response) {
|
| + try {
|
| + var map = JSON.decode(response);
|
| + Logger.root.info('Decoded $id');
|
| + return toObservable(map);
|
| + } catch (e, st) {
|
| + return toObservable({
|
| + 'type': 'Error',
|
| + 'id': '',
|
| + 'kind': 'DecodeError',
|
| + 'message': '$e',
|
| + });
|
| + }
|
| + }).catchError((error) {
|
| + return toObservable({
|
| + 'type': 'Error',
|
| + 'id': '',
|
| + 'kind': 'LastResort',
|
| + 'message': '$error'
|
| + });
|
| + });
|
| + }
|
| +
|
| + /// Get [id] as a [String] from the service directly. See [getAsMap].
|
| + Future<String> getString(String id);
|
| +}
|
|
|