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

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

Issue 184233007: Refactor Observatory (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 observatory_element; 5 library observatory_element;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
9 import 'package:observatory/observatory.dart';
10 export 'package:observatory/observatory.dart';
11 9
12 /// Base class for all custom elements. Holds an observable 10 /// Base class for all Observatory custom elements.
13 /// [ObservableApplication] and applies author styles.
14 @CustomTag('observatory-element') 11 @CustomTag('observatory-element')
15 class ObservatoryElement extends PolymerElement { 12 class ObservatoryElement extends PolymerElement {
16 ObservatoryElement.created() : super.created(); 13 ObservatoryElement.created() : super.created();
17 14
18 void enteredView() { 15 void enteredView() {
19 super.enteredView(); 16 super.enteredView();
20 } 17 }
21 18
22 void leftView() { 19 void leftView() {
23 super.leftView(); 20 super.leftView();
24 } 21 }
25 22
26 void attributeChanged(String name, String oldValue, String newValue) { 23 void attributeChanged(String name, var oldValue, var newValue) {
27 super.attributeChanged(name, oldValue, newValue); 24 super.attributeChanged(name, oldValue, newValue);
28 } 25 }
29 26
30 @published ObservatoryApplication app;
31 void appChanged(oldValue) {
32 }
33 bool get applyAuthorStyles => true; 27 bool get applyAuthorStyles => true;
34 28
35 static String _zeroPad(int value, int pad) { 29 static String _zeroPad(int value, int pad) {
36 String prefix = ""; 30 String prefix = "";
37 while (pad > 1) { 31 while (pad > 1) {
38 int pow10 = pow(10, pad - 1); 32 int pow10 = pow(10, pad - 1);
39 if (value < pow10) { 33 if (value < pow10) {
40 prefix = prefix + "0"; 34 prefix = prefix + "0";
41 } 35 }
42 pad--; 36 pad--;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } else if (bytes < bytesPerTB) { 79 } else if (bytes < bytesPerTB) {
86 return "${(bytes / bytesPerGB).round()}GB"; 80 return "${(bytes / bytesPerGB).round()}GB";
87 } else { 81 } else {
88 return "${(bytes / bytesPerTB).round()}TB"; 82 return "${(bytes / bytesPerTB).round()}TB";
89 } 83 }
90 } 84 }
91 85
92 String fileAndLine(Map frame) { 86 String fileAndLine(Map frame) {
93 var file = frame['script']['user_name']; 87 var file = frame['script']['user_name'];
94 var shortFile = file.substring(file.lastIndexOf('/') + 1); 88 var shortFile = file.substring(file.lastIndexOf('/') + 1);
95 return "${shortFile}:${frame['line']}"; 89 return "${shortFile}:${frame['line']}";
96 } 90 }
97 91
98 bool isNullRef(String type) { 92 bool isNullRef(String type) {
99 return type == '@Null'; 93 return type == '@Null';
100 } 94 }
101 95
102 bool isIntRef(String type) { 96 bool isIntRef(String type) {
103 return (type == '@Smi' || 97 return (type == '@Smi' ||
104 type == '@Mint' || 98 type == '@Mint' ||
105 type == '@Bigint'); 99 type == '@Bigint');
(...skipping 26 matching lines...) Expand all
132 '@Mint', 126 '@Mint',
133 '@Biginit', 127 '@Biginit',
134 '@Bool', 128 '@Bool',
135 '@String', 129 '@String',
136 '@Closure', 130 '@Closure',
137 '@Instance', 131 '@Instance',
138 '@GrowableObjectArray', 132 '@GrowableObjectArray',
139 '@Array'].contains(type)); 133 '@Array'].contains(type));
140 } 134 }
141 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698