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

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

Issue 2762583003: Revert "Run dartfmt on all files under runtime." (Closed)
Patch Set: Created 3 years, 9 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) 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:svg'; 8 import 'dart:svg';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:math'; 10 import 'dart:math';
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return new Future.value(null); 202 return new Future.value(null);
203 } 203 }
204 if (debugger.currentFrame == null) { 204 if (debugger.currentFrame == null) {
205 debugger.console.print('No stack'); 205 debugger.console.print('No stack');
206 return new Future.value(null); 206 return new Future.value(null);
207 } 207 }
208 try { 208 try {
209 debugger.downFrame(count); 209 debugger.downFrame(count);
210 debugger.console.print('frame = ${debugger.currentFrame}'); 210 debugger.console.print('frame = ${debugger.currentFrame}');
211 } catch (e) { 211 } catch (e) {
212 debugger.console.print('frame must be in range [${e.start}..${e.end-1}]'); 212 debugger.console.print(
213 'frame must be in range [${e.start}..${e.end-1}]');
213 } 214 }
214 return new Future.value(null); 215 return new Future.value(null);
215 } 216 }
216 217
217 String helpShort = 'Move down one or more frames (hotkey: [Page Down])'; 218 String helpShort = 'Move down one or more frames (hotkey: [Page Down])';
218 219
219 String helpLong = 'Move down one or more frames.\n' 220 String helpLong = 'Move down one or more frames.\n'
220 '\n' 221 '\n'
221 'Hotkey: [Page Down]\n' 222 'Hotkey: [Page Down]\n'
222 '\n' 223 '\n'
(...skipping 13 matching lines...) Expand all
236 return new Future.value(null); 237 return new Future.value(null);
237 } 238 }
238 if (debugger.currentFrame == null) { 239 if (debugger.currentFrame == null) {
239 debugger.console.print('No stack'); 240 debugger.console.print('No stack');
240 return new Future.value(null); 241 return new Future.value(null);
241 } 242 }
242 try { 243 try {
243 debugger.upFrame(count); 244 debugger.upFrame(count);
244 debugger.console.print('frame = ${debugger.currentFrame}'); 245 debugger.console.print('frame = ${debugger.currentFrame}');
245 } on RangeError catch (e) { 246 } on RangeError catch (e) {
246 debugger.console.print('frame must be in range [${e.start}..${e.end-1}]'); 247 debugger.console.print(
248 'frame must be in range [${e.start}..${e.end-1}]');
247 } 249 }
248 return new Future.value(null); 250 return new Future.value(null);
249 } 251 }
250 252
251 String helpShort = 'Move up one or more frames (hotkey: [Page Up])'; 253 String helpShort = 'Move up one or more frames (hotkey: [Page Up])';
252 254
253 String helpLong = 'Move up one or more frames.\n' 255 String helpLong = 'Move up one or more frames.\n'
254 '\n' 256 '\n'
255 'Hotkey: [Page Up]\n' 257 'Hotkey: [Page Up]\n'
256 '\n' 258 '\n'
(...skipping 15 matching lines...) Expand all
272 return new Future.value(null); 274 return new Future.value(null);
273 } 275 }
274 if (debugger.currentFrame == null) { 276 if (debugger.currentFrame == null) {
275 debugger.console.print('No stack'); 277 debugger.console.print('No stack');
276 return new Future.value(null); 278 return new Future.value(null);
277 } 279 }
278 try { 280 try {
279 debugger.currentFrame = frame; 281 debugger.currentFrame = frame;
280 debugger.console.print('frame = ${debugger.currentFrame}'); 282 debugger.console.print('frame = ${debugger.currentFrame}');
281 } on RangeError catch (e) { 283 } on RangeError catch (e) {
282 debugger.console.print('frame must be in range [${e.start}..${e.end-1}]'); 284 debugger.console.print(
285 'frame must be in range [${e.start}..${e.end-1}]');
283 } 286 }
284 return new Future.value(null); 287 return new Future.value(null);
285 } 288 }
286 289
287 String helpShort = 'Set the current frame'; 290 String helpShort = 'Set the current frame';
288 291
289 String helpLong = 'Set the current frame.\n' 292 String helpLong = 'Set the current frame.\n'
290 '\n' 293 '\n'
291 'Syntax: frame <number>\n' 294 'Syntax: frame <number>\n'
292 ' f <count>\n'; 295 ' f <count>\n';
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 411
409 Future run(List<String> args) async { 412 Future run(List<String> args) async {
410 try { 413 try {
411 int count = 1; 414 int count = 1;
412 if (args.length == 1) { 415 if (args.length == 1) {
413 count = int.parse(args[0]); 416 count = int.parse(args[0]);
414 } else if (args.length > 1) { 417 } else if (args.length > 1) {
415 debugger.console.print('rewind expects 0 or 1 argument'); 418 debugger.console.print('rewind expects 0 or 1 argument');
416 return; 419 return;
417 } else if (count < 1 || count > debugger.stackDepth) { 420 } else if (count < 1 || count > debugger.stackDepth) {
418 debugger.console 421 debugger.console.print(
419 .print('frame must be in range [1..${debugger.stackDepth - 1}]'); 422 'frame must be in range [1..${debugger.stackDepth - 1}]');
420 return; 423 return;
421 } 424 }
422 await debugger.rewind(count); 425 await debugger.rewind(count);
423 } on S.ServerRpcException catch (e) { 426 } on S.ServerRpcException catch(e) {
424 if (e.code == S.ServerRpcException.kCannotResume) { 427 if (e.code == S.ServerRpcException.kCannotResume) {
425 debugger.console.printRed(e.data['details']); 428 debugger.console.printRed(e.data['details']);
426 } else { 429 } else {
427 rethrow; 430 rethrow;
428 } 431 }
429 } 432 }
430 } 433 }
431 434
432 String helpShort = 'Rewind the stack to a previous frame'; 435 String helpShort = 'Rewind the stack to a previous frame';
433 436
434 String helpLong = 'Rewind the stack to a previous frame.\n' 437 String helpLong =
438 'Rewind the stack to a previous frame.\n'
435 '\n' 439 '\n'
436 'Syntax: rewind\n' 440 'Syntax: rewind\n'
437 ' rewind <count>\n'; 441 ' rewind <count>\n';
438 } 442 }
439 443
440 class ReloadCommand extends DebuggerCommand { 444 class ReloadCommand extends DebuggerCommand {
441 ReloadCommand(Debugger debugger) : super(debugger, 'reload', []); 445 ReloadCommand(Debugger debugger) : super(debugger, 'reload', []);
442 446
443 Future run(List<String> args) async { 447 Future run(List<String> args) async {
444 try { 448 try {
445 int count = 1; 449 int count = 1;
446 if (args.length > 0) { 450 if (args.length > 0) {
447 debugger.console.print('reload expects no arguments'); 451 debugger.console.print('reload expects no arguments');
448 return; 452 return;
449 } 453 }
450 await debugger.isolate.reloadSources(); 454 await debugger.isolate.reloadSources();
451 debugger.console.print('reload complete'); 455 debugger.console.print('reload complete');
452 await debugger.refreshStack(); 456 await debugger.refreshStack();
453 } on S.ServerRpcException catch (e) { 457 } on S.ServerRpcException catch(e) {
454 if (e.code == S.ServerRpcException.kIsolateReloadBarred || 458 if (e.code == S.ServerRpcException.kIsolateReloadBarred ||
455 e.code == S.ServerRpcException.kIsolateReloadFailed || 459 e.code == S.ServerRpcException.kIsolateReloadFailed ||
456 e.code == S.ServerRpcException.kIsolateIsReloading) { 460 e.code == S.ServerRpcException.kIsolateIsReloading) {
457 debugger.console.printRed(e.data['details']); 461 debugger.console.printRed(e.data['details']);
458 } else { 462 } else {
459 rethrow; 463 rethrow;
460 } 464 }
461 } 465 }
462 } 466 }
463 467
464 String helpShort = 'Reload the sources for the current isolate'; 468 String helpShort = 'Reload the sources for the current isolate';
465 469
466 String helpLong = 'Reload the sources for the current isolate.\n' 470 String helpLong =
471 'Reload the sources for the current isolate.\n'
467 '\n' 472 '\n'
468 'Syntax: reload\n'; 473 'Syntax: reload\n';
469 } 474 }
470 475
471 class ClsCommand extends DebuggerCommand { 476 class ClsCommand extends DebuggerCommand {
472 ClsCommand(Debugger debugger) : super(debugger, 'cls', []) {} 477 ClsCommand(Debugger debugger) : super(debugger, 'cls', []) {}
473 478
474 Future run(List<String> args) { 479 Future run(List<String> args) {
475 debugger.console.clear(); 480 debugger.console.clear();
476 debugger.console.newline(); 481 debugger.console.newline();
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 // TODO(turnidge): Implement real command line history. 1826 // TODO(turnidge): Implement real command line history.
1822 String lastCommand; 1827 String lastCommand;
1823 1828
1824 Future run(String command) { 1829 Future run(String command) {
1825 if (command == '' && lastCommand != null) { 1830 if (command == '' && lastCommand != null) {
1826 command = lastCommand; 1831 command = lastCommand;
1827 } 1832 }
1828 console.printBold('\$ $command'); 1833 console.printBold('\$ $command');
1829 return cmd.runCommand(command).then((_) { 1834 return cmd.runCommand(command).then((_) {
1830 lastCommand = command; 1835 lastCommand = command;
1831 }).catchError((e, s) { 1836 }).catchError(
1832 console.printRed('Unable to execute command because the connection ' 1837 (e, s) {
1833 'to the VM has been closed'); 1838 console.printRed('Unable to execute command because the connection '
1834 }, test: (e) => e is S.NetworkRpcException).catchError((e, s) { 1839 'to the VM has been closed');
1835 console.printRed(e.toString()); 1840 }, test: (e) => e is S.NetworkRpcException
1836 }, test: (e) => e is CommandException).catchError((e, s) { 1841 ).catchError(
1837 if (s != null) { 1842 (e, s) {
1838 console.printRed('Internal error: $e\n$s'); 1843 console.printRed(e.toString());
1839 } else { 1844 }, test: (e) => e is CommandException
1840 console.printRed('Internal error: $e\n'); 1845 ).catchError(
1846 (e, s) {
1847 if (s != null) {
1848 console.printRed('Internal error: $e\n$s');
1849 } else {
1850 console.printRed('Internal error: $e\n');
1851 }
1841 } 1852 }
1842 }); 1853 );
1843 } 1854 }
1844 1855
1845 String historyPrev(String command) { 1856 String historyPrev(String command) {
1846 return cmd.historyPrev(command); 1857 return cmd.historyPrev(command);
1847 } 1858 }
1848 1859
1849 String historyNext(String command) { 1860 String historyNext(String command) {
1850 return cmd.historyNext(command); 1861 return cmd.historyNext(command);
1851 } 1862 }
1852 1863
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 2410
2400 // Is this the current frame? 2411 // Is this the current frame?
2401 bool _current = false; 2412 bool _current = false;
2402 2413
2403 // Has this frame been pinned open? 2414 // Has this frame been pinned open?
2404 bool _pinned = false; 2415 bool _pinned = false;
2405 2416
2406 bool _expanded = false; 2417 bool _expanded = false;
2407 2418
2408 void setCurrent(bool value) { 2419 void setCurrent(bool value) {
2409 Future load = (_frame.function != null) 2420 Future load =
2410 ? _frame.function.load() 2421 (_frame.function != null) ?
2411 : new Future.value(null); 2422 _frame.function.load() :
2423 new Future.value(null);
2412 load.then((func) { 2424 load.then((func) {
2413 _current = value; 2425 _current = value;
2414 if (_current) { 2426 if (_current) {
2415 _expand(); 2427 _expand();
2416 scrollIntoView(); 2428 scrollIntoView();
2417 } else { 2429 } else {
2418 if (_pinned) { 2430 if (_pinned) {
2419 _expand(); 2431 _expand();
2420 } else { 2432 } else {
2421 _unexpand(); 2433 _unexpand();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 classes.add('current'); 2473 classes.add('current');
2462 } else { 2474 } else {
2463 classes.remove('current'); 2475 classes.remove('current');
2464 } 2476 }
2465 if ((_frame.kind == M.FrameKind.asyncSuspensionMarker) || 2477 if ((_frame.kind == M.FrameKind.asyncSuspensionMarker) ||
2466 (_frame.kind == M.FrameKind.asyncCausal)) { 2478 (_frame.kind == M.FrameKind.asyncCausal)) {
2467 classes.add('causalFrame'); 2479 classes.add('causalFrame');
2468 } 2480 }
2469 if (_frame.kind == M.FrameKind.asyncSuspensionMarker) { 2481 if (_frame.kind == M.FrameKind.asyncSuspensionMarker) {
2470 final content = <Element>[ 2482 final content = <Element>[
2471 new SpanElement()..children = _createMarkerHeader(_frame.marker) 2483 new SpanElement()
2484 ..children = _createMarkerHeader(_frame.marker)
2472 ]; 2485 ];
2473 children = content; 2486 children = content;
2474 return; 2487 return;
2475 } 2488 }
2476 ButtonElement expandButton; 2489 ButtonElement expandButton;
2477 final content = <Element>[ 2490 final content = <Element>[
2478 expandButton = new ButtonElement() 2491 expandButton = new ButtonElement()
2479 ..children = _createHeader() 2492 ..children = _createHeader()
2480 ..onClick.listen((e) async { 2493 ..onClick.listen((e) async {
2481 if (e.target is AnchorElement) { 2494 if (e.target is AnchorElement) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 new DivElement() 2596 new DivElement()
2584 ..classes = ['frameId'] 2597 ..classes = ['frameId']
2585 ..text = 'Frame ${_frame.index}', 2598 ..text = 'Frame ${_frame.index}',
2586 new SpanElement()..text = '$marker', 2599 new SpanElement()..text = '$marker',
2587 ] 2600 ]
2588 ]; 2601 ];
2589 return [ 2602 return [
2590 new DivElement() 2603 new DivElement()
2591 ..classes = ['frameSummary'] 2604 ..classes = ['frameSummary']
2592 ..children = content 2605 ..children = content
2593 ]; 2606 ];
2594 } 2607 }
2595 2608
2596 List<Element> _createHeader() { 2609 List<Element> _createHeader() {
2597 final content = [ 2610 final content = [
2598 new DivElement() 2611 new DivElement()
2599 ..classes = ['frameSummaryText'] 2612 ..classes = ['frameSummaryText']
2600 ..children = [ 2613 ..children = [
2601 new DivElement() 2614 new DivElement()
2602 ..classes = ['frameId'] 2615 ..classes = ['frameId']
2603 ..text = 'Frame ${_frame.index}', 2616 ..text = 'Frame ${_frame.index}',
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 } 2650 }
2638 2651
2639 bool matchFrame(S.Frame newFrame) { 2652 bool matchFrame(S.Frame newFrame) {
2640 if (newFrame.kind != _frame.kind) { 2653 if (newFrame.kind != _frame.kind) {
2641 return false; 2654 return false;
2642 } 2655 }
2643 if (newFrame.function == null) { 2656 if (newFrame.function == null) {
2644 return frame.function == null; 2657 return frame.function == null;
2645 } 2658 }
2646 return (newFrame.function.id == _frame.function.id && 2659 return (newFrame.function.id == _frame.function.id &&
2647 newFrame.location.script.id == frame.location.script.id); 2660 newFrame.location.script.id ==
2661 frame.location.script.id);
2648 } 2662 }
2649 2663
2650 void updateFrame(S.Frame newFrame) { 2664 void updateFrame(S.Frame newFrame) {
2651 assert(matchFrame(newFrame)); 2665 assert(matchFrame(newFrame));
2652 _frame = newFrame; 2666 _frame = newFrame;
2653 } 2667 }
2654 2668
2655 S.Script get script => _frame.location.script; 2669 S.Script get script => _frame.location.script;
2656 2670
2657 int _varsTop(varsDiv) { 2671 int _varsTop(varsDiv) {
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
3321 ..setAttribute('height', '24') 3335 ..setAttribute('height', '24')
3322 ..children = [ 3336 ..children = [
3323 new PathElement() 3337 new PathElement()
3324 ..setAttribute( 3338 ..setAttribute(
3325 'd', 3339 'd',
3326 'M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 ' 3340 'M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 '
3327 '10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 ' 3341 '10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 '
3328 '0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 ' 3342 '0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 '
3329 '9h2V7h-2v2z') 3343 '9h2V7h-2v2z')
3330 ]; 3344 ];
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/cli/command.dart ('k') | runtime/observatory/lib/src/elements/heap_snapshot.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698