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

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

Issue 1181943009: Re-focus the command box after a stack refresh. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 debugger_page_element; 5 library debugger_page_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:observatory/app.dart'; 10 import 'package:observatory/app.dart';
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 'Refresh debugging information of various sorts.\n' 848 'Refresh debugging information of various sorts.\n'
849 '\n' 849 '\n'
850 'Syntax: refresh <subcommand>\n'; 850 'Syntax: refresh <subcommand>\n';
851 } 851 }
852 852
853 // Tracks the state for an isolate debugging session. 853 // Tracks the state for an isolate debugging session.
854 class ObservatoryDebugger extends Debugger { 854 class ObservatoryDebugger extends Debugger {
855 RootCommand cmd; 855 RootCommand cmd;
856 DebuggerPageElement page; 856 DebuggerPageElement page;
857 DebuggerConsoleElement console; 857 DebuggerConsoleElement console;
858 DebuggerInputElement input;
858 DebuggerStackElement stackElement; 859 DebuggerStackElement stackElement;
859 ServiceMap stack; 860 ServiceMap stack;
860 String exceptions = "none"; // Last known setting. 861 String exceptions = "none"; // Last known setting.
861 862
862 int get currentFrame => _currentFrame; 863 int get currentFrame => _currentFrame;
863 void set currentFrame(int value) { 864 void set currentFrame(int value) {
864 if (value != null && (value < 0 || value >= stackDepth)) { 865 if (value != null && (value < 0 || value >= stackDepth)) {
865 throw new RangeError.range(value, 0, stackDepth); 866 throw new RangeError.range(value, 0, stackDepth);
866 } 867 }
867 _currentFrame = value; 868 _currentFrame = value;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 return isolate.getStack().then((result) { 985 return isolate.getStack().then((result) {
985 stack = result; 986 stack = result;
986 // TODO(turnidge): Replace only the changed part of the stack to 987 // TODO(turnidge): Replace only the changed part of the stack to
987 // reduce flicker. 988 // reduce flicker.
988 stackElement.updateStack(stack, pauseEvent); 989 stackElement.updateStack(stack, pauseEvent);
989 if (stack['frames'].length > 0) { 990 if (stack['frames'].length > 0) {
990 currentFrame = 0; 991 currentFrame = 0;
991 } else { 992 } else {
992 currentFrame = null; 993 currentFrame = null;
993 } 994 }
995 input.focus();
994 }); 996 });
995 } 997 }
996 998
997 void reportStatus() { 999 void reportStatus() {
998 if (_isolate == null) { 1000 if (_isolate == null) {
999 console.print('No current isolate'); 1001 console.print('No current isolate');
1000 } else if (_isolate.idle) { 1002 } else if (_isolate.idle) {
1001 console.print('Isolate is idle'); 1003 console.print('Isolate is idle');
1002 } else if (_isolate.running) { 1004 } else if (_isolate.running) {
1003 console.print("Isolate is running (type 'pause' to interrupt)"); 1005 console.print("Isolate is running (type 'pause' to interrupt)");
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 int fixedHeight = navbarHeight + splitterHeight + cmdHeight; 1252 int fixedHeight = navbarHeight + splitterHeight + cmdHeight;
1251 int available = windowHeight - fixedHeight; 1253 int available = windowHeight - fixedHeight;
1252 int stackHeight = available ~/ 1.6; 1254 int stackHeight = available ~/ 1.6;
1253 stackDiv.style.setProperty('height', '${stackHeight}px'); 1255 stackDiv.style.setProperty('height', '${stackHeight}px');
1254 1256
1255 // Wire the debugger object to the stack, console, and command line. 1257 // Wire the debugger object to the stack, console, and command line.
1256 var stackElement = $['stackElement']; 1258 var stackElement = $['stackElement'];
1257 debugger.stackElement = stackElement; 1259 debugger.stackElement = stackElement;
1258 stackElement.debugger = debugger; 1260 stackElement.debugger = debugger;
1259 debugger.console = $['console']; 1261 debugger.console = $['console'];
1260 $['commandline'].debugger = debugger; 1262 debugger.input = $['commandline'];
1263 debugger.input.debugger = debugger;
1261 debugger.init(); 1264 debugger.init();
1262 } 1265 }
1263
1264 } 1266 }
1265 1267
1266 @CustomTag('debugger-stack') 1268 @CustomTag('debugger-stack')
1267 class DebuggerStackElement extends ObservatoryElement { 1269 class DebuggerStackElement extends ObservatoryElement {
1268 @published Isolate isolate; 1270 @published Isolate isolate;
1269 @observable bool hasStack = false; 1271 @observable bool hasStack = false;
1270 @observable bool hasMessages = false; 1272 @observable bool hasMessages = false;
1271 @observable bool isSampled = false; 1273 @observable bool isSampled = false;
1272 @observable int currentFrame; 1274 @observable int currentFrame;
1273 ObservatoryDebugger debugger; 1275 ObservatoryDebugger debugger;
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 busy = false; 1708 busy = false;
1707 break; 1709 break;
1708 1710
1709 default: 1711 default:
1710 busy = false; 1712 busy = false;
1711 break; 1713 break;
1712 } 1714 }
1713 }); 1715 });
1714 } 1716 }
1715 1717
1718 void focus() {
1719 $['textBox'].focus();
1720 }
1721
1716 DebuggerInputElement.created() : super.created(); 1722 DebuggerInputElement.created() : super.created();
1717 } 1723 }
1718 1724
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698