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

Side by Side Diff: runtime/observatory/lib/src/elements/class_view.dart

Issue 823403004: Begin migrating the vm service from a rest-style interface to a json-rpc style interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove old-style standalone tests. Created 5 years, 10 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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library class_view_element; 5 library class_view_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'observatory_element.dart'; 8 import 'observatory_element.dart';
9 import 'package:observatory/service.dart'; 9 import 'package:observatory/service.dart';
10 import 'package:polymer/polymer.dart'; 10 import 'package:polymer/polymer.dart';
11 11
12 @CustomTag('class-view') 12 @CustomTag('class-view')
13 class ClassViewElement extends ObservatoryElement { 13 class ClassViewElement extends ObservatoryElement {
14 @published Class cls; 14 @published Class cls;
15 @observable ServiceMap instances; 15 @observable ServiceMap instances;
16 @observable int retainedBytes; 16 @observable int retainedBytes;
17 @observable ObservableList mostRetained; 17 @observable ObservableList mostRetained;
18 ClassViewElement.created() : super.created(); 18 ClassViewElement.created() : super.created();
19 19
20 Future<ServiceObject> eval(String text) { 20 Future<ServiceObject> eval(String expression) {
21 return cls.get("eval?expr=${Uri.encodeComponent(text)}"); 21 return cls.isolate.eval(cls, expression);
22 } 22 }
23 23
24 Future<ServiceObject> reachable(var limit) { 24 Future<ServiceObject> reachable(var limit) {
25 return cls.get("instances?limit=$limit") 25 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) {
26 .then((ServiceMap obj) { 26 instances = obj;
27 instances = obj; 27 });
28 });
29 } 28 }
30 29
31 Future<ServiceObject> retainedToplist(var limit) { 30 Future<ServiceObject> retainedToplist(var limit) {
32 return cls.isolate.fetchHeapSnapshot().then( 31 return cls.isolate.fetchHeapSnapshot().then(
33 (HeapSnapshot snapshot) => 32 (HeapSnapshot snapshot) =>
34 Future.wait(snapshot.getMostRetained(classId: cls.vmCid, 33 Future.wait(snapshot.getMostRetained(classId: cls.vmCid,
35 limit: 10))).then( 34 limit: 10))).then(
36 (List<ServiceObject> most) { 35 (List<ServiceObject> most) {
37 mostRetained = new ObservableList.from(most); 36 mostRetained = new ObservableList.from(most);
38 }); 37 });
39 } 38 }
40 39
41 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link". 40 // TODO(koda): Add no-arg "calculate-link" instead of reusing "eval-link".
42 Future<ServiceObject> retainedSize(var dummy) { 41 Future<ServiceObject> retainedSize(var dummy) {
43 return cls.get("retained").then((Instance obj) { 42 return cls.isolate.getRetainedSize(cls).then((Instance obj) {
44 retainedBytes = int.parse(obj.valueAsString); 43 retainedBytes = int.parse(obj.valueAsString);
45 }); 44 });
46 } 45 }
47 46
48 void refresh(var done) { 47 void refresh(var done) {
49 instances = null; 48 instances = null;
50 retainedBytes = null; 49 retainedBytes = null;
51 mostRetained = null; 50 mostRetained = null;
52 cls.reload().whenComplete(done); 51 cls.reload().whenComplete(done);
53 } 52 }
54 53
55 void refreshCoverage(var done) { 54 void refreshCoverage(var done) {
56 cls.refreshCoverage().whenComplete(done); 55 cls.refreshCoverage().whenComplete(done);
57 } 56 }
58 } 57 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/app/page.dart ('k') | runtime/observatory/lib/src/elements/cpu_profile.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698