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

Unified Diff: runtime/bin/vmservice/observatory/lib/src/elements/debugger.dart

Issue 584293002: Begin implementing a debugger page in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: use flexbox, basic commandline Created 6 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/bin/vmservice/observatory/lib/src/elements/debugger.dart
diff --git a/runtime/bin/vmservice/observatory/lib/src/elements/debugger.dart b/runtime/bin/vmservice/observatory/lib/src/elements/debugger.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ae4dbe2077f20a071cecb3717a068361d756d961
--- /dev/null
+++ b/runtime/bin/vmservice/observatory/lib/src/elements/debugger.dart
@@ -0,0 +1,125 @@
+// Copyright (c) 2014, 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.
+
+library debugger_page_element;
+
+import 'dart:html';
+import 'observatory_element.dart';
+import 'package:observatory/service.dart';
+import 'package:polymer/polymer.dart';
+
+@CustomTag('debugger-page')
+class DebuggerPageElement extends ObservatoryElement {
+ @published Isolate isolate;
+ @published bool showConsole = false;
+
+ DebuggerPageElement.created() : super.created();
+
+ @override
+ void attached() {
+ super.attached();
+
+ // TODO(turnidge): Get these values from the DOM.
+ const int navbarHeight = 56;
+ const int splitterHeight = 12;
+ const int cmdHeight = 22;
+
+ var stack = $['stack'];
+ int windowHeight = window.innerHeight;
+ int available = windowHeight - (navbarHeight + splitterHeight);
+ int stackHeight = available ~/ 1.3;
+ if (showConsole) {
+ stack.style.setProperty('height', '${stackHeight}px');
+ } else {
+ stack.style.setProperty('height', '${available}px');
+ }
+ }
+}
+
+@CustomTag('debugger-stack')
+class DebuggerStackElement extends ObservatoryElement {
+ @published Isolate isolate;
+ @published ServiceMap stack;
+ @published int activeFrame = 0;
+
+ isolateChanged(oldValue) {
+ isolate.get('stacktrace').then((result) {
+ stack = result;
+ });
+ }
+
+ DebuggerStackElement.created() : super.created();
+}
+
+@CustomTag('debugger-frame')
+class DebuggerFrameElement extends ObservatoryElement {
+ @published ObservableMap frame;
+ @published bool expand = false; // Expand by default
Cutch 2014/09/22 17:36:30 comment is out of sync
turnidge 2014/09/30 18:48:48 Done.
+ @observable String scriptHeight;
+ @observable bool expanded = false;
+ @observable bool busy = false;
+
+ DebuggerFrameElement.created() : super.created();
+
+ @override
+ void attached() {
+ super.attached();
+ int windowHeight = window.innerHeight;
+ scriptHeight = '${windowHeight ~/ 1.6}px';
+ }
+
+ void expandChanged(oldValue) {
+ if (expand != expanded) {
+ toggleExpand(null, null, null);
+ }
+ }
+
+ void toggleExpand(var a, var b, var c) {
+ if (busy) {
+ return;
+ }
+ busy = true;
+ frame['function'].load().then((func) {
+ expanded = !expanded;
+ busy = false;
+ });
+ }
+}
+
+@CustomTag('debugger-console')
+class DebuggerConsoleElement extends ObservatoryElement {
+ @published Isolate isolate;
+
+ DebuggerConsoleElement.created() : super.created();
+}
+
+@CustomTag('debugger-input')
+class DebuggerInputElement extends ObservatoryElement {
+ @published Isolate isolate;
+ @published String text = '';
+
+ @override
+ void ready() {
+ super.ready();
+ var textBox = $['textBox'];
+ textBox.select();
+ textBox.onKeyDown.listen((KeyboardEvent e) {
+ switch (e.keyCode) {
+ case KeyCode.TAB:
+ e.preventDefault();
+ textBox.setRangeText('TAB');
+ textBox.setSelectionRange(textBox.selectionStart + 3,
+ textBox.selectionStart + 3);
+ break;
+ case KeyCode.ENTER:
+ print('Debugger command (not implemented): $text');
+ text = '';
+ break;
+ }
+ });
+ }
+
+ DebuggerInputElement.created() : super.created();
+}
+

Powered by Google App Engine
This is Rietveld 408576698