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

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

Issue 2298563002: Removed const from classes arrays in Observatory (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 persitent_handles_page; 5 library persitent_handles_page;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:observatory/models.dart' as M; 9 import 'package:observatory/models.dart' as M;
10 import 'package:observatory/src/elements/containers/virtual_collection.dart'; 10 import 'package:observatory/src/elements/containers/virtual_collection.dart';
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 : (_handles.weakElements.toList() 132 : (_handles.weakElements.toList()
133 ..sort(_createSorter())), 133 ..sort(_createSorter())),
134 _createWeakLine, 134 _createWeakLine,
135 _updateWeakLine, 135 _updateWeakLine,
136 createHeader: _createWeakHeader)); 136 createHeader: _createWeakHeader));
137 } 137 }
138 138
139 List<Element> _createHandlers(String name, List items, create, update, 139 List<Element> _createHandlers(String name, List items, create, update,
140 {createHeader}) { 140 {createHeader}) {
141 return [ 141 return [
142 new DivElement()..classes = const ['content-centered-big'] 142 new DivElement()..classes = ['content-centered-big']
143 ..children = [ 143 ..children = [
144 new HeadingElement.h1() 144 new HeadingElement.h1()
145 ..text = items == null ? '$name' 145 ..text = items == null ? '$name'
146 : '$name (${items.length})', 146 : '$name (${items.length})',
147 new HRElement(), 147 new HRElement(),
148 ], 148 ],
149 new DivElement()..classes = const ['persistent-handles'] 149 new DivElement()..classes = ['persistent-handles']
150 ..children = [ 150 ..children = [
151 items == null 151 items == null
152 ? (new HeadingElement.h2()..classes = const ['content-centered-big'] 152 ? (new HeadingElement.h2()..classes = ['content-centered-big']
153 ..text = 'Loading...') 153 ..text = 'Loading...')
154 : new VirtualCollectionElement(create, update, items: items, 154 : new VirtualCollectionElement(create, update, items: items,
155 createHeader: createHeader, 155 createHeader: createHeader,
156 queue: _r.queue) 156 queue: _r.queue)
157 ] 157 ]
158 ]; 158 ];
159 } 159 }
160 160
161 _createSorter() { 161 _createSorter() {
162 var getter; 162 var getter;
(...skipping 10 matching lines...) Expand all
173 } 173 }
174 switch (_sortingDirection) { 174 switch (_sortingDirection) {
175 case _SortingDirection.ascending: 175 case _SortingDirection.ascending:
176 return (a, b) => getter(a).compareTo(getter(b)); 176 return (a, b) => getter(a).compareTo(getter(b));
177 case _SortingDirection.descending: 177 case _SortingDirection.descending:
178 return (a, b) => getter(b).compareTo(getter(a)); 178 return (a, b) => getter(b).compareTo(getter(a));
179 } 179 }
180 } 180 }
181 181
182 static Element _createLine() => 182 static Element _createLine() =>
183 new DivElement()..classes = const ['collection-item'] 183 new DivElement()..classes = ['collection-item']
184 ..text = 'object'; 184 ..text = 'object';
185 185
186 static Element _createWeakLine() => 186 static Element _createWeakLine() =>
187 new DivElement() 187 new DivElement()
188 ..classes = const ['weak-item'] 188 ..classes = ['weak-item']
189 ..children = [ 189 ..children = [
190 new SpanElement()..classes = const ['external-size'] 190 new SpanElement()..classes = ['external-size']
191 ..text = '0B', 191 ..text = '0B',
192 new SpanElement()..classes = const ['peer'] 192 new SpanElement()..classes = ['peer']
193 ..text = '0x00000', 193 ..text = '0x00000',
194 new SpanElement()..classes = const ['object'], 194 new SpanElement()..classes = ['object'],
195 new SpanElement()..classes = const ['finalizer'] 195 new SpanElement()..classes = ['finalizer']
196 ..text = 'dart::Class::Method()' 196 ..text = 'dart::Class::Method()'
197 ]; 197 ];
198 198
199 Element _createWeakHeader() => 199 Element _createWeakHeader() =>
200 new DivElement() 200 new DivElement()
201 ..classes = const ['weak-item'] 201 ..classes = ['weak-item']
202 ..children = [ 202 ..children = [
203 _createHeaderButton(const ['external-size'], 'External Size', 203 _createHeaderButton(const ['external-size'], 'External Size',
204 _SortingField.externalSize, 204 _SortingField.externalSize,
205 _SortingDirection.descending), 205 _SortingDirection.descending),
206 _createHeaderButton(const ['peer'], 'Peer', 206 _createHeaderButton(const ['peer'], 'Peer',
207 _SortingField.peer, 207 _SortingField.peer,
208 _SortingDirection.descending), 208 _SortingDirection.descending),
209 new SpanElement()..classes = const ['object'] 209 new SpanElement()..classes = ['object']
210 ..text = 'Object', 210 ..text = 'Object',
211 _createHeaderButton(const ['finalizer'], 'Finalizer Callback', 211 _createHeaderButton(const ['finalizer'], 'Finalizer Callback',
212 _SortingField.finalizerCallback, 212 _SortingField.finalizerCallback,
213 _SortingDirection.ascending) 213 _SortingDirection.ascending)
214 ]; 214 ];
215 215
216 ButtonElement _createHeaderButton(List<String> classes, 216 ButtonElement _createHeaderButton(List<String> classes,
217 String text, 217 String text,
218 _SortingField field, 218 _SortingField field,
219 _SortingDirection direction) => 219 _SortingDirection direction) =>
(...skipping 20 matching lines...) Expand all
240 _sortingField = field; 240 _sortingField = field;
241 } 241 }
242 _r.dirty(); 242 _r.dirty();
243 } 243 }
244 244
245 void _updateWeakLine(Element e, M.WeakPersistentHandle item, 245 void _updateWeakLine(Element e, M.WeakPersistentHandle item,
246 index) { 246 index) {
247 e.children[0].text = Utils.formatSize(_getExternalSize(item)); 247 e.children[0].text = Utils.formatSize(_getExternalSize(item));
248 e.children[1].text = '${_getPeer(item)}'; 248 e.children[1].text = '${_getPeer(item)}';
249 e.children[2] = anyRef(_isolate, item.object, _instances, queue: _r.queue) 249 e.children[2] = anyRef(_isolate, item.object, _instances, queue: _r.queue)
250 ..classes = const ['object']; 250 ..classes = ['object'];
251 e.children[3]..text = '${_getFinalizerCallback(item)}' 251 e.children[3]..text = '${_getFinalizerCallback(item)}'
252 ..title = '${_getFinalizerCallback(item)}'; 252 ..title = '${_getFinalizerCallback(item)}';
253 } 253 }
254 254
255 void _updateLine(Element e, M.PersistentHandle item, 255 void _updateLine(Element e, M.PersistentHandle item,
256 index) { 256 index) {
257 e.children = [ 257 e.children = [
258 anyRef(_isolate, item.object, _instances, queue: _r.queue) 258 anyRef(_isolate, item.object, _instances, queue: _r.queue)
259 ..classes = const ['object'] 259 ..classes = ['object']
260 ]; 260 ];
261 } 261 }
262 262
263 Future _refresh({bool gc: false, bool reset: false}) async { 263 Future _refresh({bool gc: false, bool reset: false}) async {
264 _handles = null; 264 _handles = null;
265 _r.dirty(); 265 _r.dirty();
266 _handles = await _repository.get(_isolate); 266 _handles = await _repository.get(_isolate);
267 _r.dirty(); 267 _r.dirty();
268 } 268 }
269 269
270 static int _getExternalSize(M.WeakPersistentHandle h) => h.externalSize; 270 static int _getExternalSize(M.WeakPersistentHandle h) => h.externalSize;
271 static String _getPeer(M.WeakPersistentHandle h) => h.peer; 271 static String _getPeer(M.WeakPersistentHandle h) => h.peer;
272 static String _getFinalizerCallback(M.WeakPersistentHandle h) => 272 static String _getFinalizerCallback(M.WeakPersistentHandle h) =>
273 '${h.callbackSymbolName} (${h.callbackAddress})'; 273 '${h.callbackSymbolName} (${h.callbackAddress})';
274 } 274 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/objectstore_view.dart ('k') | runtime/observatory/lib/src/elements/retaining_path.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698