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

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

Issue 2345023003: Use dartfmt on Observatory code (Closed)
Patch Set: merge 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:observatory/models.dart' as M 7 import 'package:observatory/models.dart' as M show IsolateRef, EventRepository;
8 show IsolateRef, EventRepository;
9 import 'package:observatory/src/elements/helpers/nav_menu.dart'; 8 import 'package:observatory/src/elements/helpers/nav_menu.dart';
10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
11 import 'package:observatory/src/elements/helpers/tag.dart'; 10 import 'package:observatory/src/elements/helpers/tag.dart';
12 import 'package:observatory/src/elements/helpers/uris.dart'; 11 import 'package:observatory/src/elements/helpers/uris.dart';
13 import 'package:observatory/src/elements/nav/menu_item.dart'; 12 import 'package:observatory/src/elements/nav/menu_item.dart';
14 13
15 class NavIsolateMenuElement extends HtmlElement implements Renderable { 14 class NavIsolateMenuElement extends HtmlElement implements Renderable {
16 static const tag = const Tag<NavIsolateMenuElement>('nav-isolate-menu', 15 static const tag = const Tag<NavIsolateMenuElement>('nav-isolate-menu',
17 dependencies: const [NavMenuItemElement.tag]); 16 dependencies: const [NavMenuItemElement.tag]);
18 17
19 RenderingScheduler _r; 18 RenderingScheduler _r;
20 19
21 Stream<RenderedEvent<NavIsolateMenuElement>> get onRendered => _r.onRendered; 20 Stream<RenderedEvent<NavIsolateMenuElement>> get onRendered => _r.onRendered;
22 21
23 M.IsolateRef _isolate; 22 M.IsolateRef _isolate;
24 M.EventRepository _events; 23 M.EventRepository _events;
25 StreamSubscription _updatesSubscription; 24 StreamSubscription _updatesSubscription;
26 Iterable<Element> _content = const []; 25 Iterable<Element> _content = const [];
27 26
28 M.IsolateRef get isolate => _isolate; 27 M.IsolateRef get isolate => _isolate;
29 Iterable<Element> get content => _content; 28 Iterable<Element> get content => _content;
30 29
31 set content(Iterable<Element> value) { 30 set content(Iterable<Element> value) {
32 _content = value.toList(); 31 _content = value.toList();
33 _r.dirty(); 32 _r.dirty();
34 } 33 }
35 34
36 factory NavIsolateMenuElement(M.IsolateRef isolate, 35 factory NavIsolateMenuElement(M.IsolateRef isolate, M.EventRepository events,
37 M.EventRepository events, {RenderingQueue queue}) { 36 {RenderingQueue queue}) {
38 assert(isolate != null); 37 assert(isolate != null);
39 assert(events != null); 38 assert(events != null);
40 NavIsolateMenuElement e = document.createElement(tag.name); 39 NavIsolateMenuElement e = document.createElement(tag.name);
41 e._r = new RenderingScheduler(e, queue: queue); 40 e._r = new RenderingScheduler(e, queue: queue);
42 e._isolate = isolate; 41 e._isolate = isolate;
43 e._events = events; 42 e._events = events;
44 return e; 43 return e;
45 } 44 }
46 45
47 NavIsolateMenuElement.created() : super.created(); 46 NavIsolateMenuElement.created() : super.created();
48 47
49 @override 48 @override
50 void attached() { 49 void attached() {
51 super.attached(); 50 super.attached();
52 _updatesSubscription = _events.onIsolateUpdate 51 _updatesSubscription = _events.onIsolateUpdate
53 .where((e) => e.isolate.id == isolate.id) 52 .where((e) => e.isolate.id == isolate.id)
54 .listen((e) { _isolate = e.isolate; _r.dirty(); }); 53 .listen((e) {
54 _isolate = e.isolate;
55 _r.dirty();
56 });
55 _r.enable(); 57 _r.enable();
56 } 58 }
57 59
58 @override 60 @override
59 void detached() { 61 void detached() {
60 super.detached(); 62 super.detached();
61 children = []; 63 children = [];
62 _r.disable(notify: true); 64 _r.disable(notify: true);
63 assert(_updatesSubscription != null); 65 assert(_updatesSubscription != null);
64 _updatesSubscription.cancel(); 66 _updatesSubscription.cancel();
65 _updatesSubscription = null; 67 _updatesSubscription = null;
66 } 68 }
67 69
68 void render() { 70 void render() {
69 final content = [ 71 final content = [
70 new NavMenuItemElement('debugger', queue: _r.queue, 72 new NavMenuItemElement('debugger',
71 link: Uris.debugger(isolate)), 73 queue: _r.queue, link: Uris.debugger(isolate)),
72 new NavMenuItemElement('class hierarchy', queue: _r.queue, 74 new NavMenuItemElement('class hierarchy',
73 link: Uris.classTree(isolate)), 75 queue: _r.queue, link: Uris.classTree(isolate)),
74 new NavMenuItemElement('cpu profile', queue: _r.queue, 76 new NavMenuItemElement('cpu profile',
75 link: Uris.cpuProfiler(isolate)), 77 queue: _r.queue, link: Uris.cpuProfiler(isolate)),
76 new NavMenuItemElement('cpu profile (table)', queue: _r.queue, 78 new NavMenuItemElement('cpu profile (table)',
77 link: Uris.cpuProfilerTable(isolate)), 79 queue: _r.queue, link: Uris.cpuProfilerTable(isolate)),
78 new NavMenuItemElement('allocation profile', queue: _r.queue, 80 new NavMenuItemElement('allocation profile',
79 link: Uris.allocationProfiler(isolate)), 81 queue: _r.queue, link: Uris.allocationProfiler(isolate)),
80 new NavMenuItemElement('heap map', queue: _r.queue, 82 new NavMenuItemElement('heap map',
81 link: Uris.heapMap(isolate)), 83 queue: _r.queue, link: Uris.heapMap(isolate)),
82 new NavMenuItemElement('metrics', queue: _r.queue, 84 new NavMenuItemElement('metrics',
83 link: Uris.metrics(isolate)), 85 queue: _r.queue, link: Uris.metrics(isolate)),
84 new NavMenuItemElement('heap snapshot', queue: _r.queue, 86 new NavMenuItemElement('heap snapshot',
85 link: Uris.heapSnapshot(isolate)), 87 queue: _r.queue, link: Uris.heapSnapshot(isolate)),
86 new NavMenuItemElement('persistent handles', queue: _r.queue, 88 new NavMenuItemElement('persistent handles',
87 link: Uris.persistentHandles(isolate)), 89 queue: _r.queue, link: Uris.persistentHandles(isolate)),
88 new NavMenuItemElement('ports', queue: _r.queue, 90 new NavMenuItemElement('ports',
89 link: Uris.ports(isolate)), 91 queue: _r.queue, link: Uris.ports(isolate)),
90 new NavMenuItemElement('logging', queue: _r.queue, 92 new NavMenuItemElement('logging',
91 link: Uris.logging(isolate)), 93 queue: _r.queue, link: Uris.logging(isolate)),
92 ]..addAll(_content); 94 ]..addAll(_content);
93 children = [ 95 children = [
94 navMenu(isolate.name, content: content, 96 navMenu(isolate.name, content: content, link: Uris.inspect(isolate))
95 link: Uris.inspect(isolate))
96 ]; 97 ];
97 } 98 }
98 } 99 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/class_menu.dart ('k') | runtime/observatory/lib/src/elements/nav/library_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698