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

Unified Diff: runtime/bin/vmservice/client/lib/src/service/vm.dart

Issue 192443004: Complete the switch to ServiceObject (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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: 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);
+}

Powered by Google App Engine
This is Rietveld 408576698