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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of service;
6
7 abstract class VM extends Observable {
8 IsolateList _isolates;
9 @reflectable IsolateList get isolates => _isolates;
10
11 void _initOnce() {
12 assert(_isolates == null);
13 _isolates = new IsolateList(this);
14 }
15
16 VM() {
17 _initOnce();
18 }
19
20 /// Get [id] as an [ObservableMap] from the service directly.
21 Future<ObservableMap> getAsMap(String id) {
22 return getString(id).then((response) {
23 try {
24 var map = JSON.decode(response);
25 Logger.root.info('Decoded $id');
26 return toObservable(map);
27 } catch (e, st) {
28 return toObservable({
29 'type': 'Error',
30 'id': '',
31 'kind': 'DecodeError',
32 'message': '$e',
33 });
34 }
35 }).catchError((error) {
36 return toObservable({
37 'type': 'Error',
38 'id': '',
39 'kind': 'LastResort',
40 'message': '$error'
41 });
42 });
43 }
44
45 /// Get [id] as a [String] from the service directly. See [getAsMap].
46 Future<String> getString(String id);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698