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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/elements/instance_ref.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
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 instance_ref_element; 5 library instance_ref_element;
6 6
7 import 'package:logging/logging.dart';
8 import 'package:polymer/polymer.dart'; 7 import 'package:polymer/polymer.dart';
8 import 'package:observatory/service.dart';
9 import 'service_ref.dart'; 9 import 'service_ref.dart';
10 10
11 @CustomTag('instance-ref') 11 @CustomTag('instance-ref')
12 class InstanceRefElement extends ServiceRefElement { 12 class InstanceRefElement extends ServiceRefElement {
13 InstanceRefElement.created() : super.created(); 13 InstanceRefElement.created() : super.created();
14 14
15 String get name {
16 if (ref == null) {
17 return super.name;
18 }
19 return ref['preview'];
20 }
21
22 String get hoverText { 15 String get hoverText {
23 if (ref != null) { 16 if (ref != null) {
24 if (ref['type'] == '@Null') { 17 if (ref.serviceType == 'Null') {
25 if (ref['id'] == 'objects/optimized-out') { 18 if (ref.id == 'objects/optimized-out') {
26 return 'This object is no longer needed and has been removed by the op timizing compiler.'; 19 return 'This object is no longer needed and has been removed by the op timizing compiler.';
27 } else if (ref['id'] == 'objects/collected') { 20 } else if (ref.id == 'objects/collected') {
28 return 'This object has been reclaimed by the garbage collector.'; 21 return 'This object has been reclaimed by the garbage collector.';
29 } else if (ref['id'] == 'objects/expired') { 22 } else if (ref.id == 'objects/expired') {
30 return 'The handle to this object has expired. Consider refreshing th e page.'; 23 return 'The handle to this object has expired. Consider refreshing th e page.';
31 } else if (ref['id'] == 'objects/not-initialized') { 24 } else if (ref.id == 'objects/not-initialized') {
32 return 'This object will be initialized once it is accessed by the pro gram.'; 25 return 'This object will be initialized once it is accessed by the pro gram.';
33 } else if (ref['id'] == 'objects/being-initialized') { 26 } else if (ref.id == 'objects/being-initialized') {
34 return 'This object is currently being initialized.'; 27 return 'This object is currently being initialized.';
35 } 28 }
36 } 29 }
37 } 30 }
38 return ''; 31 return super.hoverText;
39 } 32 }
40 33
41 // TODO(turnidge): This is here to workaround vm/dart2js differences. 34 // TODO(turnidge): This is here to workaround vm/dart2js differences.
42 dynamic expander() { 35 dynamic expander() {
43 return expandEvent; 36 return expandEvent;
44 } 37 }
45 38
46 void expandEvent(bool expand, var done) { 39 void expandEvent(bool expand, var done) {
47 print("Calling expandEvent"); 40 assert(ref is ServiceMap);
41 ServiceMap refMap = ref;
48 if (expand) { 42 if (expand) {
49 isolate.getMap(objectId).then((map) { 43 refMap.reload().then((_) {
50 if (map['type'] == 'Null') { 44 if (refMap['preview'] != null) {
51 // The object is no longer available. For example, the 45 refMap.name = refMap['preview'];
52 // object id may have expired or the object may have been 46 refMap.vmName = refMap['preview'];
53 // collected by the gc. 47 }
54 map['type'] = '@Null';
55 ref = map;
56 } else {
57 ref['fields'] = map['fields'];
58 ref['elements'] = map['elements'];
59 ref['length'] = map['length'];
60 }
61 ref['fields'] = map['fields'];
62 ref['elements'] = map['elements'];
63 ref['length'] = map['length'];
64 }).catchError((e, trace) {
65 Logger.root.severe('Error while expanding instance-ref: $e\n$trace');
66 }).whenComplete(done); 48 }).whenComplete(done);
67 } else { 49 } else {
68 ref['fields'] = null; 50 refMap['fields'] = null;
69 ref['elements'] = null; 51 refMap['elements'] = null;
70 done(); 52 done();
71 } 53 }
72 } 54 }
73 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698