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

Unified Diff: runtime/observatory/lib/src/elements/isolate/location.dart

Issue 2304463002: Converted Observatory vm-view && isolate-view elements (Closed)
Patch Set: Fixed typo 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/isolate/location.dart
diff --git a/runtime/observatory/lib/src/elements/isolate/location.dart b/runtime/observatory/lib/src/elements/isolate/location.dart
new file mode 100644
index 0000000000000000000000000000000000000000..fffadf608f11caecc8540227eb490e9cd5d6ddbf
--- /dev/null
+++ b/runtime/observatory/lib/src/elements/isolate/location.dart
@@ -0,0 +1,125 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:html';
+import 'dart:async';
+import 'package:observatory/models.dart' as M;
+import 'package:observatory/src/elements/function_ref.dart';
+import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
+import 'package:observatory/src/elements/helpers/tag.dart';
+import 'package:observatory/src/elements/source_link.dart';
+
+class IsolateLocationElement extends HtmlElement implements Renderable {
+ static const tag = const Tag<IsolateLocationElement>('isolate-location',
+ dependencies: const [
+ FunctionRefElement.tag,
+ SourceLinkElement.tag
+ ]);
+
+ RenderingScheduler<IsolateLocationElement> _r;
+
+ Stream<RenderedEvent<IsolateLocationElement>> get onRendered =>
+ _r.onRendered;
+
+ M.Isolate _isolate;
+ M.EventRepository _events;
+ M.ScriptRepository _scripts;
+ StreamSubscription _debugSubscription;
+ StreamSubscription _isolateSubscription;
+
+ factory IsolateLocationElement(M.Isolate isolate,
+ M.EventRepository events,
+ M.ScriptRepository scripts,
+ {RenderingQueue queue}) {
+ assert(isolate != null);
+ assert(events != null);
+ assert(scripts != null);
+ IsolateLocationElement e = document.createElement(tag.name);
+ e._r = new RenderingScheduler(e, queue: queue);
+ e._isolate = isolate;
+ e._events = events;
+ e._scripts = scripts;
+ return e;
+ }
+
+ IsolateLocationElement.created() : super.created();
+
+ @override
+ void attached() {
+ super.attached();
+ _r.enable();
+ _debugSubscription = _events.onDebugEvent.listen(_eventListener);
+ _isolateSubscription = _events.onIsolateEvent.listen(_eventListener);
+ }
+
+ @override
+ void detached() {
+ super.detached();
+ children = [];
+ _r.disable(notify: true);
+ _debugSubscription.cancel();
+ _isolateSubscription.cancel();
+ }
+
+ void render() {
+ switch (_isolate.status) {
+ case M.IsolateStatus.loading:
+ children = [new SpanElement()..text = 'not yet runnable'];
+ break;
+ case M.IsolateStatus.running:
+ children = [
+ new SpanElement()..text = 'at ',
+ new FunctionRefElement(_isolate,
+ M.topFrame(_isolate.pauseEvent).function,
+ queue: _r.queue),
+ new SpanElement()..text = ' (',
+ new SourceLinkElement(_isolate,
+ M.topFrame(_isolate.pauseEvent).location,
+ _scripts,
+ queue: _r.queue),
+ new SpanElement()..text = ') '
+ ];
+ break;
+ case M.IsolateStatus.paused:
+ if (_isolate.pauseEvent is M.PauseStartEvent) {
+ children = [new SpanElement()..text = 'at isolate start'];
+ } else if (_isolate.pauseEvent is M.PauseExitEvent) {
+ children = [new SpanElement()..text = 'at isolate exit'];
+ } else if (_isolate.pauseEvent is M.NoneEvent) {
+ children = [new SpanElement()..text = 'not yet runnable'];
+ } else {
+ final content = <Element>[];
+ if (_isolate.pauseEvent is M.PauseBreakpointEvent) {
+ content.add(new SpanElement()..text = 'by breakpoint');
+ } else if (_isolate.pauseEvent is M.PauseExceptionEvent) {
+ content.add(new SpanElement()..text = 'by exception');
+ }
+ if (M.topFrame(_isolate.pauseEvent) != null) {
+ content.addAll([
+ new SpanElement()..text = ' at ',
+ new FunctionRefElement(_isolate,
+ M.topFrame(_isolate.pauseEvent).function,
+ queue: _r.queue),
+ new SpanElement()..text = ' (',
+ new SourceLinkElement(_isolate,
+ M.topFrame(_isolate.pauseEvent).location,
+ _scripts,
+ queue: _r.queue),
+ new SpanElement()..text = ') '
+ ]);
+ }
+ children = content;
+ }
+ break;
+ default:
+ children = const [];
+ }
+ }
+
+ void _eventListener(e) {
+ if (e.isolate.id == _isolate.id) {
+ _r.dirty();
+ }
+ }
+}
« no previous file with comments | « runtime/observatory/lib/src/elements/helpers/uris.dart ('k') | runtime/observatory/lib/src/elements/isolate/run_state.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698