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

Unified Diff: Source/devtools/front_end/BreakpointManager.js

Issue 14294004: Implementing console command 'debug'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added test. Created 7 years, 8 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: Source/devtools/front_end/BreakpointManager.js
diff --git a/Source/devtools/front_end/BreakpointManager.js b/Source/devtools/front_end/BreakpointManager.js
index 747879a7a5cabf22ee51fe50b69fd36ca9089062..3f0f0efa77a620bc4770e5105763c8930a86ca47 100644
--- a/Source/devtools/front_end/BreakpointManager.js
+++ b/Source/devtools/front_end/BreakpointManager.js
@@ -47,6 +47,7 @@ WebInspector.BreakpointManager = function(breakpointStorage, debuggerModel, work
this._sourceFilesWithRestoredBreakpoints = {};
this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this);
+ this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.SetBreakpointRequested, this._setBreakpointRequested, this);
this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._projectWillReset, this);
this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this);
}
@@ -147,24 +148,25 @@ WebInspector.BreakpointManager.prototype = {
setBreakpoint: function(uiSourceCode, lineNumber, condition, enabled)
{
this._debuggerModel.setBreakpointsActive(true);
- return this._innerSetBreakpoint(uiSourceCode, lineNumber, condition, enabled);
+ return this._innerSetBreakpoint(uiSourceCode, lineNumber, 0, condition, enabled);
},
/**
* @param {WebInspector.UISourceCode} uiSourceCode
* @param {number} lineNumber
+ * @param {number} columnNumber
* @param {string} condition
* @param {boolean} enabled
* @return {WebInspector.BreakpointManager.Breakpoint}
*/
- _innerSetBreakpoint: function(uiSourceCode, lineNumber, condition, enabled)
+ _innerSetBreakpoint: function(uiSourceCode, lineNumber, columnNumber, condition, enabled)
{
var breakpoint = this.findBreakpoint(uiSourceCode, lineNumber);
if (breakpoint) {
breakpoint._updateBreakpoint(condition, enabled);
return breakpoint;
}
- breakpoint = new WebInspector.BreakpointManager.Breakpoint(this, uiSourceCode, lineNumber, condition, enabled);
+ breakpoint = new WebInspector.BreakpointManager.Breakpoint(this, uiSourceCode, lineNumber, columnNumber, condition, enabled);
this._breakpoints.put(breakpoint);
return breakpoint;
},
@@ -318,6 +320,14 @@ WebInspector.BreakpointManager.prototype = {
breakpoint._addResolvedLocation(location);
},
+ _setBreakpointRequested: function(event)
+ {
+ var location = /** @type {WebInspector.DebuggerModel.Location} */ (event.data.location);
+ var script = this._debuggerModel.scriptForId(location.scriptId);
+ var uiLocation = script.rawLocationToUILocation(location.lineNumber, location.columnNumber);
+ this._innerSetBreakpoint(uiLocation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber, "", true);
+ },
+
/**
* @param {WebInspector.BreakpointManager.Breakpoint} breakpoint
* @param {boolean} removeFromStorage
@@ -380,13 +390,14 @@ WebInspector.BreakpointManager.prototype = {
* @param {WebInspector.BreakpointManager} breakpointManager
* @param {WebInspector.UISourceCode} uiSourceCode
* @param {number} lineNumber
+ * @param {number} columnNumber
* @param {string} condition
* @param {boolean} enabled
*/
-WebInspector.BreakpointManager.Breakpoint = function(breakpointManager, uiSourceCode, lineNumber, condition, enabled)
+WebInspector.BreakpointManager.Breakpoint = function(breakpointManager, uiSourceCode, lineNumber, columnNumber, condition, enabled)
{
this._breakpointManager = breakpointManager;
- this._primaryUILocation = new WebInspector.UILocation(uiSourceCode, lineNumber, 0);
+ this._primaryUILocation = new WebInspector.UILocation(uiSourceCode, lineNumber, columnNumber);
this._sourceFileId = WebInspector.BreakpointManager.sourceFileId(uiSourceCode);
/** @type {Array.<WebInspector.Script.Location>} */
this._liveLocations = [];
@@ -617,7 +628,7 @@ WebInspector.BreakpointManager.Storage.prototype = {
for (var id in this._breakpoints) {
var breakpoint = this._breakpoints[id];
if (breakpoint.sourceFileId === sourceFileId)
- this._breakpointManager._innerSetBreakpoint(uiSourceCode, breakpoint.lineNumber, breakpoint.condition, breakpoint.enabled);
+ this._breakpointManager._innerSetBreakpoint(uiSourceCode, breakpoint.lineNumber, breakpoint.columnNumber, breakpoint.condition, breakpoint.enabled);
}
delete this._muted;
},

Powered by Google App Engine
This is Rietveld 408576698