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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/elements/function_view.dart

Issue 376293003: Observatory: Promote function to ServiceObject (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add deployed/ Created 6 years, 5 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 function_view_element; 5 library function_view_element;
6 6
7 import 'observatory_element.dart'; 7 import 'observatory_element.dart';
8 import 'package:observatory/service.dart'; 8 import 'package:observatory/service.dart';
9 9
10 import 'package:polymer/polymer.dart'; 10 import 'package:polymer/polymer.dart';
11 11
12 @CustomTag('function-view') 12 @CustomTag('function-view')
13 class FunctionViewElement extends ObservatoryElement { 13 class FunctionViewElement extends ObservatoryElement {
14 @published ServiceMap function; 14 @published ServiceFunction function;
15 FunctionViewElement.created() : super.created(); 15 FunctionViewElement.created() : super.created();
16 16
17 // TODO(turnidge): Once we create a Function object, these fields
18 // should move there.
19 @published String qualifiedName;
20 @published String kind;
21
22 String _getQualifiedName(ServiceMap function) {
23 var parent = (function != null && function['parent'] != null
24 ? function['parent'] : null);
25 if (parent != null) {
26 return "${_getQualifiedName(parent)}.${function['user_name']}";
27 }
28 Class cls = (function != null &&
29 function['owner'] != null &&
30 function['owner'].serviceType == 'Class'
31 ? function['owner'] : null);
32 if (cls != null) {
33 return "${cls.name}.${function['user_name']}";
34 }
35 return "${function['user_name']}";
36 }
37
38 void functionChanged(oldValue) {
39 notifyPropertyChange(#qualifiedName, 0, 1);
40 notifyPropertyChange(#kind, 0, 1);
41 qualifiedName = _getQualifiedName(function);
42 switch(function['kind']) {
43 case 'kRegularFunction':
44 kind = 'function';
45 break;
46 case 'kClosureFunction':
47 kind = 'closure function';
48 break;
49 case 'kSignatureFunction':
50 kind = 'signature function';
51 break;
52 case 'kGetterFunction':
53 kind = 'getter function';
54 break;
55 case 'kSetterFunction':
56 kind = 'setter function';
57 break;
58 case 'kConstructor':
59 kind = 'constructor';
60 break;
61 case 'kImplicitGetterFunction':
62 kind = 'implicit getter function';
63 break;
64 case 'kImplicitSetterFunction':
65 kind = 'implicit setter function';
66 break;
67 case 'kStaticInitializer':
68 kind = 'static initializer';
69 break;
70 case 'kMethodExtractor':
71 kind = 'method extractor';
72 break;
73 case 'kNoSuchMethodDispatcher':
74 kind = 'noSuchMethod dispatcher';
75 break;
76 case 'kInvokeFieldDispatcher':
77 kind = 'invoke field dispatcher';
78 break;
79 default:
80 kind = 'UNKNOWN';
81 break;
82 }
83 }
84
85 void refresh(var done) { 17 void refresh(var done) {
86 function.reload().whenComplete(done); 18 function.reload().whenComplete(done);
87 } 19 }
88 } 20 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698