OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 this._removeFromDebugger(); | 500 this._removeFromDebugger(); |
501 this._breakpointManager._removeBreakpoint(this, removeFromStorage); | 501 this._breakpointManager._removeBreakpoint(this, removeFromStorage); |
502 }, | 502 }, |
503 | 503 |
504 _setInDebugger: function() | 504 _setInDebugger: function() |
505 { | 505 { |
506 console.assert(!this._debuggerId); | 506 console.assert(!this._debuggerId); |
507 var rawLocation = this._primaryUILocation.uiLocationToRawLocation(); | 507 var rawLocation = this._primaryUILocation.uiLocationToRawLocation(); |
508 var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Locati
on} */ (rawLocation); | 508 var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Locati
on} */ (rawLocation); |
509 if (debuggerModelLocation) | 509 if (debuggerModelLocation) |
510 this._breakpointManager._debuggerModel.setBreakpointByScriptLocation
(debuggerModelLocation, this._condition, didSetBreakpoint.bind(this)); | 510 this._breakpointManager._debuggerModel.setBreakpointByScriptLocation
(debuggerModelLocation, this._condition, this._didSetBreakpointInDebugger.bind(t
his)); |
511 else | 511 else |
512 this._breakpointManager._debuggerModel.setBreakpointByURL(this._prim
aryUILocation.uiSourceCode.url, this._primaryUILocation.lineNumber, 0, this._con
dition, didSetBreakpoint.bind(this)); | 512 this._breakpointManager._debuggerModel.setBreakpointByURL(this._prim
aryUILocation.uiSourceCode.url, this._primaryUILocation.lineNumber, 0, this._con
dition, this._didSetBreakpointInDebugger.bind(this)); |
| 513 }, |
513 | 514 |
514 /** | 515 /** |
515 * @this {WebInspector.BreakpointManager.Breakpoint} | 516 * @this {WebInspector.BreakpointManager.Breakpoint} |
516 * @param {?DebuggerAgent.BreakpointId} breakpointId | 517 * @param {?DebuggerAgent.BreakpointId} breakpointId |
517 * @param {Array.<WebInspector.DebuggerModel.Location>} locations | 518 * @param {Array.<WebInspector.DebuggerModel.Location>} locations |
518 */ | 519 */ |
519 function didSetBreakpoint(breakpointId, locations) | 520 _didSetBreakpointInDebugger: function(breakpointId, locations) |
520 { | 521 { |
521 if (!breakpointId) { | 522 if (!breakpointId) { |
522 this._resetLocations(); | 523 this._resetLocations(); |
523 this._breakpointManager._removeBreakpoint(this, false); | 524 this._breakpointManager._removeBreakpoint(this, false); |
| 525 return; |
| 526 } |
| 527 |
| 528 this._debuggerId = breakpointId; |
| 529 this._breakpointManager._breakpointForDebuggerId[breakpointId] = this; |
| 530 |
| 531 if (!locations.length) { |
| 532 this._fakeBreakpointAtPrimaryLocation(); |
| 533 return; |
| 534 } |
| 535 |
| 536 this._resetLocations(); |
| 537 for (var i = 0; i < locations.length; ++i) { |
| 538 var script = this._breakpointManager._debuggerModel.scriptForId(loca
tions[i].scriptId); |
| 539 var uiLocation = script.rawLocationToUILocation(locations[i].lineNum
ber, locations[i].columnNumber); |
| 540 if (this._breakpointManager.findBreakpoint(uiLocation.uiSourceCode,
uiLocation.lineNumber)) { |
| 541 // location clash |
| 542 this.remove(); |
524 return; | 543 return; |
525 } | 544 } |
| 545 } |
526 | 546 |
527 this._debuggerId = breakpointId; | 547 for (var i = 0; i < locations.length; ++i) |
528 this._breakpointManager._breakpointForDebuggerId[breakpointId] = thi
s; | 548 this._addResolvedLocation(locations[i]); |
529 | |
530 if (!locations.length) { | |
531 this._fakeBreakpointAtPrimaryLocation(); | |
532 return; | |
533 } | |
534 | |
535 this._resetLocations(); | |
536 for (var i = 0; i < locations.length; ++i) { | |
537 var script = this._breakpointManager._debuggerModel.scriptForId(
locations[i].scriptId); | |
538 var uiLocation = script.rawLocationToUILocation(locations[i].lin
eNumber, locations[i].columnNumber); | |
539 if (this._breakpointManager.findBreakpoint(uiLocation.uiSourceCo
de, uiLocation.lineNumber)) { | |
540 // location clash | |
541 this.remove(); | |
542 return; | |
543 } | |
544 } | |
545 | |
546 for (var i = 0; i < locations.length; ++i) | |
547 this._addResolvedLocation(locations[i]); | |
548 } | |
549 }, | 549 }, |
550 | 550 |
551 _removeFromDebugger: function() | 551 _removeFromDebugger: function() |
552 { | 552 { |
553 if (this._debuggerId) { | 553 if (this._debuggerId) { |
554 this._breakpointManager._debuggerModel.removeBreakpoint(this._debugg
erId); | 554 this._breakpointManager._debuggerModel.removeBreakpoint(this._debugg
erId); |
555 delete this._breakpointManager._breakpointForDebuggerId[this._debugg
erId]; | 555 delete this._breakpointManager._breakpointForDebuggerId[this._debugg
erId]; |
556 delete this._debuggerId; | 556 delete this._debuggerId; |
557 } | 557 } |
558 }, | 558 }, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 { | 660 { |
661 var primaryUILocation = breakpoint.primaryUILocation(); | 661 var primaryUILocation = breakpoint.primaryUILocation(); |
662 this.sourceFileId = breakpoint._sourceFileId; | 662 this.sourceFileId = breakpoint._sourceFileId; |
663 this.lineNumber = primaryUILocation.lineNumber; | 663 this.lineNumber = primaryUILocation.lineNumber; |
664 this.condition = breakpoint.condition(); | 664 this.condition = breakpoint.condition(); |
665 this.enabled = breakpoint.enabled(); | 665 this.enabled = breakpoint.enabled(); |
666 } | 666 } |
667 | 667 |
668 /** @type {WebInspector.BreakpointManager} */ | 668 /** @type {WebInspector.BreakpointManager} */ |
669 WebInspector.breakpointManager = null; | 669 WebInspector.breakpointManager = null; |
OLD | NEW |