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

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

Issue 1150303004: Switch to using SourceLocation universally in service protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: post merge 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
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 class BreakCommand extends DebuggerCommand { 369 class BreakCommand extends DebuggerCommand {
370 BreakCommand(Debugger debugger) : super(debugger, 'break', []); 370 BreakCommand(Debugger debugger) : super(debugger, 'break', []);
371 371
372 Future run(List<String> args) async { 372 Future run(List<String> args) async {
373 if (args.length > 1) { 373 if (args.length > 1) {
374 debugger.console.print('not implemented'); 374 debugger.console.print('not implemented');
375 return new Future.value(null); 375 return new Future.value(null);
376 } 376 }
377 var arg = (args.length == 0 ? '' : args[0]); 377 var arg = (args.length == 0 ? '' : args[0]);
378 var loc = await SourceLocation.parse(debugger, arg); 378 var loc = await DebuggerLocation.parse(debugger, arg);
379 if (loc.valid) { 379 if (loc.valid) {
380 if (loc.function != null) { 380 if (loc.function != null) {
381 try { 381 try {
382 await debugger.isolate.addBreakpointAtEntry(loc.function); 382 await debugger.isolate.addBreakpointAtEntry(loc.function);
383 } on ServerRpcException catch(e) { 383 } on ServerRpcException catch(e) {
384 if (e.code == ServerRpcException.kCannotAddBreakpoint) { 384 if (e.code == ServerRpcException.kCannotAddBreakpoint) {
385 debugger.console.print('Unable to set breakpoint at ${loc}'); 385 debugger.console.print('Unable to set breakpoint at ${loc}');
386 } else { 386 } else {
387 rethrow; 387 rethrow;
388 } 388 }
(...skipping 18 matching lines...) Expand all
407 } 407 }
408 } else { 408 } else {
409 debugger.console.print(loc.errorMessage); 409 debugger.console.print(loc.errorMessage);
410 } 410 }
411 } 411 }
412 412
413 Future<List<String>> complete(List<String> args) { 413 Future<List<String>> complete(List<String> args) {
414 if (args.length != 1) { 414 if (args.length != 1) {
415 return new Future.value([args.join('')]); 415 return new Future.value([args.join('')]);
416 } 416 }
417 // TODO - fix SourceLocation complete 417 // TODO - fix DebuggerLocation complete
418 return new Future.value(SourceLocation.complete(debugger, args[0])); 418 return new Future.value(DebuggerLocation.complete(debugger, args[0]));
419 } 419 }
420 420
421 String helpShort = 'Add a breakpoint by source location or function name'; 421 String helpShort = 'Add a breakpoint by source location or function name';
422 422
423 String helpLong = 423 String helpLong =
424 'Add a breakpoint by source location or function name.\n' 424 'Add a breakpoint by source location or function name.\n'
425 '\n' 425 '\n'
426 'Syntax: break ' 426 'Syntax: break '
427 '- Break at the current position\n' 427 '- Break at the current position\n'
428 ' break <line> ' 428 ' break <line> '
(...skipping 20 matching lines...) Expand all
449 449
450 class ClearCommand extends DebuggerCommand { 450 class ClearCommand extends DebuggerCommand {
451 ClearCommand(Debugger debugger) : super(debugger, 'clear', []); 451 ClearCommand(Debugger debugger) : super(debugger, 'clear', []);
452 452
453 Future run(List<String> args) { 453 Future run(List<String> args) {
454 if (args.length > 1) { 454 if (args.length > 1) {
455 debugger.console.print('not implemented'); 455 debugger.console.print('not implemented');
456 return new Future.value(null); 456 return new Future.value(null);
457 } 457 }
458 var arg = (args.length == 0 ? '' : args[0]); 458 var arg = (args.length == 0 ? '' : args[0]);
459 return SourceLocation.parse(debugger, arg).then((loc) { 459 return DebuggerLocation.parse(debugger, arg).then((loc) {
460 if (loc.valid) { 460 if (loc.valid) {
461 if (loc.function != null) { 461 if (loc.function != null) {
462 debugger.console.print( 462 debugger.console.print(
463 'Ignoring breakpoint at $loc: ' 463 'Ignoring breakpoint at $loc: '
464 'Function entry breakpoints not yet implemented'); 464 'Function entry breakpoints not yet implemented');
465 return null; 465 return null;
466 } 466 }
467 if (loc.col != null) { 467 if (loc.col != null) {
468 // TODO(turnidge): Add tokenPos clear support. 468 // TODO(turnidge): Add tokenPos clear support.
469 debugger.console.print( 469 debugger.console.print(
470 'Ignoring column: ' 470 'Ignoring column: '
471 'clearing breakpoint at a specific column not yet implemented'); 471 'clearing breakpoint at a specific column not yet implemented');
472 } 472 }
473 473
474 for (var bpt in debugger.isolate.breakpoints.values) { 474 for (var bpt in debugger.isolate.breakpoints.values) {
475 var script = bpt.script; 475 var script = bpt.location.script;
476 if (script.id == loc.script.id) { 476 if (script.id == loc.script.id) {
477 assert(script.loaded); 477 assert(script.loaded);
478 var line = script.tokenToLine(bpt.tokenPos); 478 var line = script.tokenToLine(bpt.location.tokenPos);
479 if (line == loc.line) { 479 if (line == loc.line) {
480 return debugger.isolate.removeBreakpoint(bpt).then((result) { 480 return debugger.isolate.removeBreakpoint(bpt).then((result) {
481 if (result is DartError) { 481 if (result is DartError) {
482 debugger.console.print( 482 debugger.console.print(
483 'Unable to clear breakpoint at ${loc}: ${result.message}') ; 483 'Unable to clear breakpoint at ${loc}: ${result.message}') ;
484 return; 484 return;
485 } 485 }
486 }); 486 });
487 } 487 }
488 } 488 }
489 } 489 }
490 debugger.console.print('No breakpoint found at ${loc}'); 490 debugger.console.print('No breakpoint found at ${loc}');
491 } else { 491 } else {
492 debugger.console.print(loc.errorMessage); 492 debugger.console.print(loc.errorMessage);
493 } 493 }
494 }); 494 });
495 } 495 }
496 496
497 Future<List<String>> complete(List<String> args) { 497 Future<List<String>> complete(List<String> args) {
498 if (args.length != 1) { 498 if (args.length != 1) {
499 return new Future.value([args.join('')]); 499 return new Future.value([args.join('')]);
500 } 500 }
501 return new Future.value(SourceLocation.complete(debugger, args[0])); 501 return new Future.value(DebuggerLocation.complete(debugger, args[0]));
502 } 502 }
503 503
504 String helpShort = 'Remove a breakpoint by source location or function name'; 504 String helpShort = 'Remove a breakpoint by source location or function name';
505 505
506 String helpLong = 506 String helpLong =
507 'Remove a breakpoint by source location or function name.\n' 507 'Remove a breakpoint by source location or function name.\n'
508 '\n' 508 '\n'
509 'Syntax: clear ' 509 'Syntax: clear '
510 '- Clear at the current position\n' 510 '- Clear at the current position\n'
511 ' clear <line> ' 511 ' clear <line> '
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 : super(debugger, 'breakpoints', []); 576 : super(debugger, 'breakpoints', []);
577 577
578 Future run(List<String> args) { 578 Future run(List<String> args) {
579 if (debugger.isolate.breakpoints.isEmpty) { 579 if (debugger.isolate.breakpoints.isEmpty) {
580 debugger.console.print('No breakpoints'); 580 debugger.console.print('No breakpoints');
581 } 581 }
582 List bpts = debugger.isolate.breakpoints.values.toList(); 582 List bpts = debugger.isolate.breakpoints.values.toList();
583 bpts.sort((a, b) => a.number - b.number); 583 bpts.sort((a, b) => a.number - b.number);
584 for (var bpt in bpts) { 584 for (var bpt in bpts) {
585 var bpId = bpt.number; 585 var bpId = bpt.number;
586 var script = bpt.script; 586 var script = bpt.location.script;
587 var tokenPos = bpt.tokenPos; 587 var tokenPos = bpt.location.tokenPos;
588 var line = script.tokenToLine(tokenPos); 588 var line = script.tokenToLine(tokenPos);
589 var col = script.tokenToCol(tokenPos); 589 var col = script.tokenToCol(tokenPos);
590 if (!bpt.resolved) { 590 if (!bpt.resolved) {
591 debugger.console.print( 591 debugger.console.print(
592 'Future breakpoint ${bpId} at ${script.name}:${line}:${col}'); 592 'Future breakpoint ${bpId} at ${script.name}:${line}:${col}');
593 } else { 593 } else {
594 debugger.console.print( 594 debugger.console.print(
595 'Breakpoint ${bpId} at ${script.name}:${line}:${col}'); 595 'Breakpoint ${bpId} at ${script.name}:${line}:${col}');
596 } 596 }
597 } 597 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 975
976 void _reportPause(ServiceEvent event) { 976 void _reportPause(ServiceEvent event) {
977 if (event.kind == ServiceEvent.kPauseStart) { 977 if (event.kind == ServiceEvent.kPauseStart) {
978 console.print( 978 console.print(
979 "Paused at isolate start (type 'continue' to start the isolate')"); 979 "Paused at isolate start (type 'continue' to start the isolate')");
980 } else if (event.kind == ServiceEvent.kPauseExit) { 980 } else if (event.kind == ServiceEvent.kPauseExit) {
981 console.print( 981 console.print(
982 "Paused at isolate exit (type 'continue' to exit the isolate')"); 982 "Paused at isolate exit (type 'continue' to exit the isolate')");
983 } 983 }
984 if (stack['frames'].length > 0) { 984 if (stack['frames'].length > 0) {
985 var frame = stack['frames'][0]; 985 Frame frame = stack['frames'][0];
986 var script = frame['script']; 986 var script = frame.location.script;
987 script.load().then((_) { 987 script.load().then((_) {
988 var line = script.tokenToLine(frame['tokenPos']); 988 var line = script.tokenToLine(frame.location.tokenPos);
989 var col = script.tokenToCol(frame['tokenPos']); 989 var col = script.tokenToCol(frame.location.tokenPos);
990 if (event.breakpoint != null) { 990 if (event.breakpoint != null) {
991 var bpId = event.breakpoint.number; 991 var bpId = event.breakpoint.number;
992 console.print('Paused at breakpoint ${bpId} at ' 992 console.print('Paused at breakpoint ${bpId} at '
993 '${script.name}:${line}:${col}'); 993 '${script.name}:${line}:${col}');
994 } else if (event.exception != null) { 994 } else if (event.exception != null) {
995 // TODO(turnidge): Test this. 995 // TODO(turnidge): Test this.
996 console.print('Paused due to exception ${event.exception} at ' 996 console.print('Paused due to exception ${event.exception} at '
997 '${script.name}:${line}:${col}'); 997 '${script.name}:${line}:${col}');
998 } else { 998 } else {
999 console.print('Paused at ${script.name}:${line}:${col}'); 999 console.print('Paused at ${script.name}:${line}:${col}');
(...skipping 11 matching lines...) Expand all
1011 break; 1011 break;
1012 case ServiceEvent.kBreakpointResolved: 1012 case ServiceEvent.kBreakpointResolved:
1013 verb = 'resolved'; 1013 verb = 'resolved';
1014 break; 1014 break;
1015 case ServiceEvent.kBreakpointRemoved: 1015 case ServiceEvent.kBreakpointRemoved:
1016 verb = 'removed'; 1016 verb = 'removed';
1017 break; 1017 break;
1018 default: 1018 default:
1019 break; 1019 break;
1020 } 1020 }
1021 var script = bpt.script; 1021 var script = bpt.location.script;
1022 return script.load().then((_) { 1022 return script.load().then((_) {
1023 var bpId = bpt.number; 1023 var bpId = bpt.number;
1024 var tokenPos = bpt.tokenPos; 1024 var tokenPos = bpt.location.tokenPos;
1025 var line = script.tokenToLine(tokenPos); 1025 var line = script.tokenToLine(tokenPos);
1026 var col = script.tokenToCol(tokenPos); 1026 var col = script.tokenToCol(tokenPos);
1027 if (bpt.resolved) { 1027 if (bpt.resolved) {
1028 console.print( 1028 console.print(
1029 'Breakpoint ${bpId} ${verb} at ${script.name}:${line}:${col}'); 1029 'Breakpoint ${bpId} ${verb} at ${script.name}:${line}:${col}');
1030 } else { 1030 } else {
1031 console.print( 1031 console.print(
1032 'Future breakpoint ${bpId} ${verb} at ${script.name}:${line}:${col}' ); 1032 'Future breakpoint ${bpId} ${verb} at ${script.name}:${line}:${col}' );
1033 } 1033 }
1034 }); 1034 });
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 1219
1220 @CustomTag('debugger-stack') 1220 @CustomTag('debugger-stack')
1221 class DebuggerStackElement extends ObservatoryElement { 1221 class DebuggerStackElement extends ObservatoryElement {
1222 @published Isolate isolate; 1222 @published Isolate isolate;
1223 @observable bool hasStack = false; 1223 @observable bool hasStack = false;
1224 @observable bool hasMessages = false; 1224 @observable bool hasMessages = false;
1225 @observable bool isSampled = false; 1225 @observable bool isSampled = false;
1226 @observable int currentFrame; 1226 @observable int currentFrame;
1227 ObservatoryDebugger debugger; 1227 ObservatoryDebugger debugger;
1228 1228
1229 _addFrame(List frameList, ObservableMap frameInfo) { 1229 _addFrame(List frameList, Frame frameInfo) {
1230 DebuggerFrameElement frameElement = new Element.tag('debugger-frame'); 1230 DebuggerFrameElement frameElement = new Element.tag('debugger-frame');
1231 frameElement.frame = frameInfo; 1231 frameElement.frame = frameInfo;
1232 1232
1233 if (frameInfo['index'] == currentFrame) { 1233 if (frameInfo.index == currentFrame) {
1234 frameElement.setCurrent(true); 1234 frameElement.setCurrent(true);
1235 } else { 1235 } else {
1236 frameElement.setCurrent(false); 1236 frameElement.setCurrent(false);
1237 } 1237 }
1238 1238
1239 var li = new LIElement(); 1239 var li = new LIElement();
1240 li.classes.add('list-group-item'); 1240 li.classes.add('list-group-item');
1241 li.children.insert(0, frameElement); 1241 li.children.insert(0, frameElement);
1242 1242
1243 frameList.insert(0, li); 1243 frameList.insert(0, li);
1244 } 1244 }
1245 1245
1246 _addMessage(List messageList, ServiceMap messageInfo) { 1246 _addMessage(List messageList, ServiceMessage messageInfo) {
1247 DebuggerMessageElement messageElement = new Element.tag('debugger-message'); 1247 DebuggerMessageElement messageElement = new Element.tag('debugger-message');
1248 messageElement.message = messageInfo; 1248 messageElement.message = messageInfo;
1249 1249
1250 var li = new LIElement(); 1250 var li = new LIElement();
1251 li.classes.add('list-group-item'); 1251 li.classes.add('list-group-item');
1252 li.children.insert(0, messageElement); 1252 li.children.insert(0, messageElement);
1253 1253
1254 messageList.add(li); 1254 messageList.add(li);
1255 } 1255 }
1256 1256
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 updateStackFrames(newStack); 1340 updateStackFrames(newStack);
1341 updateStackMessages(newStack); 1341 updateStackMessages(newStack);
1342 isSampled = pauseEvent == null; 1342 isSampled = pauseEvent == null;
1343 } 1343 }
1344 1344
1345 void setCurrentFrame(int value) { 1345 void setCurrentFrame(int value) {
1346 currentFrame = value; 1346 currentFrame = value;
1347 List frameElements = $['frameList'].children; 1347 List frameElements = $['frameList'].children;
1348 for (var frameElement in frameElements) { 1348 for (var frameElement in frameElements) {
1349 var dbgFrameElement = frameElement.children[0]; 1349 var dbgFrameElement = frameElement.children[0];
1350 if (dbgFrameElement.frame['index'] == currentFrame) { 1350 if (dbgFrameElement.frame.index == currentFrame) {
1351 dbgFrameElement.setCurrent(true); 1351 dbgFrameElement.setCurrent(true);
1352 } else { 1352 } else {
1353 dbgFrameElement.setCurrent(false); 1353 dbgFrameElement.setCurrent(false);
1354 } 1354 }
1355 } 1355 }
1356 } 1356 }
1357 1357
1358 Set<Script> activeScripts() { 1358 Set<Script> activeScripts() {
1359 var s = new Set<Script>(); 1359 var s = new Set<Script>();
1360 List frameElements = $['frameList'].children; 1360 List frameElements = $['frameList'].children;
(...skipping 17 matching lines...) Expand all
1378 } else { 1378 } else {
1379 return new Future.value(null); 1379 return new Future.value(null);
1380 } 1380 }
1381 } 1381 }
1382 1382
1383 DebuggerStackElement.created() : super.created(); 1383 DebuggerStackElement.created() : super.created();
1384 } 1384 }
1385 1385
1386 @CustomTag('debugger-frame') 1386 @CustomTag('debugger-frame')
1387 class DebuggerFrameElement extends ObservatoryElement { 1387 class DebuggerFrameElement extends ObservatoryElement {
1388 @published ObservableMap frame; 1388 @published Frame frame;
1389 1389
1390 // Is this the current frame? 1390 // Is this the current frame?
1391 bool _current = false; 1391 bool _current = false;
1392 1392
1393 // Has this frame been pinned open? 1393 // Has this frame been pinned open?
1394 bool _pinned = false; 1394 bool _pinned = false;
1395 1395
1396 void setCurrent(bool value) { 1396 void setCurrent(bool value) {
1397 busy = true; 1397 busy = true;
1398 frame['function'].load().then((func) { 1398 frame.function.load().then((func) {
1399 _current = value; 1399 _current = value;
1400 var frameOuter = $['frameOuter']; 1400 var frameOuter = $['frameOuter'];
1401 if (_current) { 1401 if (_current) {
1402 frameOuter.classes.add('current'); 1402 frameOuter.classes.add('current');
1403 expanded = true; 1403 expanded = true;
1404 frameOuter.classes.add('shadow'); 1404 frameOuter.classes.add('shadow');
1405 scrollIntoView(); 1405 scrollIntoView();
1406 } else { 1406 } else {
1407 frameOuter.classes.remove('current'); 1407 frameOuter.classes.remove('current');
1408 if (_pinned) { 1408 if (_pinned) {
1409 expanded = true; 1409 expanded = true;
1410 frameOuter.classes.add('shadow'); 1410 frameOuter.classes.add('shadow');
1411 } else { 1411 } else {
1412 expanded = false; 1412 expanded = false;
1413 frameOuter.classes.remove('shadow'); 1413 frameOuter.classes.remove('shadow');
1414 } 1414 }
1415 } 1415 }
1416 busy = false; 1416 busy = false;
1417 }); 1417 });
1418 } 1418 }
1419 1419
1420 @observable String scriptHeight; 1420 @observable String scriptHeight;
1421 @observable bool expanded = false; 1421 @observable bool expanded = false;
1422 @observable bool busy = false; 1422 @observable bool busy = false;
1423 1423
1424 DebuggerFrameElement.created() : super.created(); 1424 DebuggerFrameElement.created() : super.created();
1425 1425
1426 bool matchFrame(ObservableMap newFrame) { 1426 bool matchFrame(Frame newFrame) {
1427 return newFrame['function'].id == frame['function'].id; 1427 return newFrame.function.id == frame.function.id;
1428 } 1428 }
1429 1429
1430 void updateFrame(ObservableMap newFrame) { 1430 void updateFrame(Frame newFrame) {
1431 assert(matchFrame(newFrame)); 1431 assert(matchFrame(newFrame));
1432 frame['index'] = newFrame['index']; 1432 frame = newFrame;
1433 frame['tokenPos'] = newFrame['tokenPos'];
1434 frame['vars'] = newFrame['vars'];
1435 } 1433 }
1436 1434
1437 Script get script => frame['script']; 1435 Script get script => frame.location.script;
1438 1436
1439 @override 1437 @override
1440 void attached() { 1438 void attached() {
1441 super.attached(); 1439 super.attached();
1442 int windowHeight = window.innerHeight; 1440 int windowHeight = window.innerHeight;
1443 scriptHeight = '${windowHeight ~/ 1.6}px'; 1441 scriptHeight = '${windowHeight ~/ 1.6}px';
1444 } 1442 }
1445 1443
1446 void toggleExpand(var a, var b, var c) { 1444 void toggleExpand(var a, var b, var c) {
1447 if (busy) { 1445 if (busy) {
1448 return; 1446 return;
1449 } 1447 }
1450 busy = true; 1448 busy = true;
1451 frame['function'].load().then((func) { 1449 frame.function.load().then((func) {
1452 _pinned = !_pinned; 1450 _pinned = !_pinned;
1453 var frameOuter = $['frameOuter']; 1451 var frameOuter = $['frameOuter'];
1454 if (_pinned) { 1452 if (_pinned) {
1455 expanded = true; 1453 expanded = true;
1456 frameOuter.classes.add('shadow'); 1454 frameOuter.classes.add('shadow');
1457 } else { 1455 } else {
1458 expanded = false; 1456 expanded = false;
1459 frameOuter.classes.remove('shadow'); 1457 frameOuter.classes.remove('shadow');
1460 } 1458 }
1461 busy = false; 1459 busy = false;
1462 }); 1460 });
1463 } 1461 }
1464 } 1462 }
1465 1463
1466 @CustomTag('debugger-message') 1464 @CustomTag('debugger-message')
1467 class DebuggerMessageElement extends ObservatoryElement { 1465 class DebuggerMessageElement extends ObservatoryElement {
1468 @published ServiceMap message; 1466 @published ServiceMessage message;
1469 @observable ServiceObject preview; 1467 @observable ServiceObject preview;
1470 1468
1471 // Is this the current message? 1469 // Is this the current message?
1472 bool _current = false; 1470 bool _current = false;
1473 1471
1474 // Has this message been pinned open? 1472 // Has this message been pinned open?
1475 bool _pinned = false; 1473 bool _pinned = false;
1476 1474
1477 void setCurrent(bool value) { 1475 void setCurrent(bool value) {
1478 _current = value; 1476 _current = value;
(...skipping 14 matching lines...) Expand all
1493 } 1491 }
1494 } 1492 }
1495 } 1493 }
1496 1494
1497 @observable String scriptHeight; 1495 @observable String scriptHeight;
1498 @observable bool expanded = false; 1496 @observable bool expanded = false;
1499 @observable bool busy = false; 1497 @observable bool busy = false;
1500 1498
1501 DebuggerMessageElement.created() : super.created(); 1499 DebuggerMessageElement.created() : super.created();
1502 1500
1503 void updateMessage(ServiceMap newMessage) { 1501 void updateMessage(ServiceMessage newMessage) {
1504 bool messageChanged = 1502 bool messageChanged =
1505 (message['messageObjectId'] != newMessage['messageObjectId']); 1503 (message.messageObjectId != newMessage.messageObjectId);
1506 message['index'] = newMessage['index']; 1504 message = newMessage;
1507 message['handlerFunction'] = newMessage['handlerFunction'];
1508 message['messageObjectId'] = newMessage['messageObjectId'];
1509 if (messageChanged) { 1505 if (messageChanged) {
1510 // Message object id has changed: clear preview and collapse. 1506 // Message object id has changed: clear preview and collapse.
1511 preview = null; 1507 preview = null;
1512 if (expanded) { 1508 if (expanded) {
1513 toggleExpand(null, null, null); 1509 toggleExpand(null, null, null);
1514 } 1510 }
1515 } 1511 }
1516 } 1512 }
1517 1513
1518 @override 1514 @override
1519 void attached() { 1515 void attached() {
1520 super.attached(); 1516 super.attached();
1521 int windowHeight = window.innerHeight; 1517 int windowHeight = window.innerHeight;
1522 scriptHeight = '${windowHeight ~/ 1.6}px'; 1518 scriptHeight = '${windowHeight ~/ 1.6}px';
1523 } 1519 }
1524 1520
1525 void toggleExpand(var a, var b, var c) { 1521 void toggleExpand(var a, var b, var c) {
1526 if (busy) { 1522 if (busy) {
1527 return; 1523 return;
1528 } 1524 }
1529 busy = true; 1525 busy = true;
1530 var function = message['handlerFunction']; 1526 var function = message.handler;
1531 var loadedFunction; 1527 var loadedFunction;
1532 if (function == null) { 1528 if (function == null) {
1533 // Complete immediately. 1529 // Complete immediately.
1534 loadedFunction = new Future.value(null); 1530 loadedFunction = new Future.value(null);
1535 } else { 1531 } else {
1536 loadedFunction = function.load(); 1532 loadedFunction = function.load();
1537 } 1533 }
1538 loadedFunction.then((_) { 1534 loadedFunction.then((_) {
1539 _pinned = !_pinned; 1535 _pinned = !_pinned;
1540 var messageOuter = $['messageOuter']; 1536 var messageOuter = $['messageOuter'];
1541 if (_pinned) { 1537 if (_pinned) {
1542 expanded = true; 1538 expanded = true;
1543 messageOuter.classes.add('shadow'); 1539 messageOuter.classes.add('shadow');
1544 } else { 1540 } else {
1545 expanded = false; 1541 expanded = false;
1546 messageOuter.classes.remove('shadow'); 1542 messageOuter.classes.remove('shadow');
1547 } 1543 }
1548 busy = false; 1544 busy = false;
1549 }); 1545 });
1550 } 1546 }
1551 1547
1552 Future<ServiceObject> previewMessage(_) { 1548 Future<ServiceObject> previewMessage(_) {
1553 return message.isolate.getObject(message['messageObjectId']).then((result) { 1549 return message.isolate.getObject(message.messageObjectId).then((result) {
1554 preview = result; 1550 preview = result;
1555 return result; 1551 return result;
1556 }); 1552 });
1557 } 1553 }
1558 } 1554 }
1559 1555
1560 @CustomTag('debugger-console') 1556 @CustomTag('debugger-console')
1561 class DebuggerConsoleElement extends ObservatoryElement { 1557 class DebuggerConsoleElement extends ObservatoryElement {
1562 @published Isolate isolate; 1558 @published Isolate isolate;
1563 1559
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 default: 1663 default:
1668 busy = false; 1664 busy = false;
1669 break; 1665 break;
1670 } 1666 }
1671 }); 1667 });
1672 } 1668 }
1673 1669
1674 DebuggerInputElement.created() : super.created(); 1670 DebuggerInputElement.created() : super.created();
1675 } 1671 }
1676 1672
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/class_view.html ('k') | runtime/observatory/lib/src/elements/debugger.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698