Title: [112236] trunk
Revision
112236
Author
podivi...@chromium.org
Date
2012-03-27 02:55:18 -0700 (Tue, 27 Mar 2012)

Log Message

Web Inspector: store UIBreakpoints on UISourceCode.
https://bugs.webkit.org/show_bug.cgi?id=82214

Source/WebCore:

This change will allow us to make breakpoint-added and breakpoint-removed events a part of UISourceCode interface.
See bug 82224 for more details.

Reviewed by Vsevolod Vlasov.

* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.prototype.uiSourceCodeRemoved):
(WebInspector.BreakpointManager.prototype.setBreakpoint):
(WebInspector.BreakpointManager.prototype.removeBreakpoint):
(WebInspector.BreakpointManager.prototype._addBreakpointToUI):
(WebInspector.BreakpointManager.prototype._removeBreakpointFromUI):
(WebInspector.BreakpointManager.prototype.debuggerReset):
* inspector/front-end/CompilerScriptMapping.js:
(WebInspector.CompilerScriptMapping.prototype.addScript):
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel.prototype._updateBreakpointsAfterLiveEdit):
(WebInspector.DebuggerPresentationModel.prototype.breakpointsForUISourceCode):
(WebInspector.DebuggerPresentationModel.prototype.findBreakpoint):
(WebInspector.UISourceCodeImpl):
(WebInspector.UISourceCodeImpl.prototype.breakpoints):
(WebInspector.UISourceCodeImpl.prototype.breakpointAdded):
(WebInspector.UISourceCodeImpl.prototype.breakpointRemoved):
* inspector/front-end/RawSourceCode.js:
(WebInspector.RawSourceCode.prototype._createUISourceCode):
* inspector/front-end/SnippetsModel.js:
(WebInspector.SnippetsScriptMapping.prototype._snippetAdded):
(WebInspector.SnippetsScriptMapping.prototype._createUISourceCodeForScript):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode.prototype.get domain):
(WebInspector.UISourceCode.prototype.get folderName):
(WebInspector.UISourceCode.prototype.get fileName):
(WebInspector.UISourceCode.prototype.get displayName):
(WebInspector.UISourceCode.prototype._parseURL):
(WebInspector.UISourceCode.prototype._didRequestContent):
(WebInspector.UISourceCode.prototype.breakpoints):
* inspector/front-end/inspector.html:

LayoutTests:

Reviewed by Vsevolod Vlasov.

* inspector/debugger/breakpoint-manager.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (112235 => 112236)


--- trunk/LayoutTests/ChangeLog	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/LayoutTests/ChangeLog	2012-03-27 09:55:18 UTC (rev 112236)
@@ -1,3 +1,12 @@
+2012-03-26  Pavel Podivilov  <podivi...@chromium.org>
+
+        Web Inspector: store UIBreakpoints on UISourceCode.
+        https://bugs.webkit.org/show_bug.cgi?id=82214
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/debugger/breakpoint-manager.html:
+
 2012-03-27  Szilard Ledan  <szle...@inf.u-szeged.hu>
 
         [Qt] Unskipped 5 passing tests.

Modified: trunk/LayoutTests/inspector/debugger/breakpoint-manager.html (112235 => 112236)


--- trunk/LayoutTests/inspector/debugger/breakpoint-manager.html	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-manager.html	2012-03-27 09:55:18 UTC (rev 112236)
@@ -58,7 +58,7 @@
     serializedBreakpoints.push(createBreakpoint("a.js", 20, "", false));
     serializedBreakpoints.push(createBreakpoint("b.js", 3, "", true));
 
-    function createUISourceCode(id, url) { return { id: id, url: url }; }
+    function createUISourceCode(id, url) { return new WebInspector.UISourceCodeImpl(id, url, null); }
     var uiSourceCodeA = createUISourceCode("a.js", "a.js");
     var uiSourceCodeB = createUISourceCode("b.js", "b.js");
 

Modified: trunk/Source/WebCore/ChangeLog (112235 => 112236)


--- trunk/Source/WebCore/ChangeLog	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/Source/WebCore/ChangeLog	2012-03-27 09:55:18 UTC (rev 112236)
@@ -1,3 +1,45 @@
+2012-03-26  Pavel Podivilov  <podivi...@chromium.org>
+
+        Web Inspector: store UIBreakpoints on UISourceCode.
+        https://bugs.webkit.org/show_bug.cgi?id=82214
+
+        This change will allow us to make breakpoint-added and breakpoint-removed events a part of UISourceCode interface.
+        See bug 82224 for more details.
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/front-end/BreakpointManager.js:
+        (WebInspector.BreakpointManager.prototype.uiSourceCodeRemoved):
+        (WebInspector.BreakpointManager.prototype.setBreakpoint):
+        (WebInspector.BreakpointManager.prototype.removeBreakpoint):
+        (WebInspector.BreakpointManager.prototype._addBreakpointToUI):
+        (WebInspector.BreakpointManager.prototype._removeBreakpointFromUI):
+        (WebInspector.BreakpointManager.prototype.debuggerReset):
+        * inspector/front-end/CompilerScriptMapping.js:
+        (WebInspector.CompilerScriptMapping.prototype.addScript):
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel.prototype._updateBreakpointsAfterLiveEdit):
+        (WebInspector.DebuggerPresentationModel.prototype.breakpointsForUISourceCode):
+        (WebInspector.DebuggerPresentationModel.prototype.findBreakpoint):
+        (WebInspector.UISourceCodeImpl):
+        (WebInspector.UISourceCodeImpl.prototype.breakpoints):
+        (WebInspector.UISourceCodeImpl.prototype.breakpointAdded):
+        (WebInspector.UISourceCodeImpl.prototype.breakpointRemoved):
+        * inspector/front-end/RawSourceCode.js:
+        (WebInspector.RawSourceCode.prototype._createUISourceCode):
+        * inspector/front-end/SnippetsModel.js:
+        (WebInspector.SnippetsScriptMapping.prototype._snippetAdded):
+        (WebInspector.SnippetsScriptMapping.prototype._createUISourceCodeForScript):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UISourceCode.prototype.get domain):
+        (WebInspector.UISourceCode.prototype.get folderName):
+        (WebInspector.UISourceCode.prototype.get fileName):
+        (WebInspector.UISourceCode.prototype.get displayName):
+        (WebInspector.UISourceCode.prototype._parseURL):
+        (WebInspector.UISourceCode.prototype._didRequestContent):
+        (WebInspector.UISourceCode.prototype.breakpoints):
+        * inspector/front-end/inspector.html:
+
 2012-03-27  Nat Duca  <nd...@chromium.org>
 
         [chromium] Fix crash with fling with tracing enabled

Modified: trunk/Source/WebCore/inspector/front-end/BreakpointManager.js (112235 => 112236)


--- trunk/Source/WebCore/inspector/front-end/BreakpointManager.js	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/Source/WebCore/inspector/front-end/BreakpointManager.js	2012-03-27 09:55:18 UTC (rev 112236)
@@ -41,11 +41,8 @@
     this._breakpointStorage = breakpointStorage;
     this._breakpointAddedDelegate = breakpointAddedDelegate;
     this._breakpointRemovedDelegate = breakpointRemovedDelegate;
+
     /**
-     * @type Map}
-     */
-    this._uiBreakpointsByUILocation = new Map();
-    /**
      * @type {Object.<string, Object.<string,WebInspector.Breakpoint>>}
      */
     this._breakpointsByUILocation = {};
@@ -88,7 +85,7 @@
      */
     uiSourceCodeRemoved: function(uiSourceCode)
     {
-        var uiBreakpoints = this._uiBreakpoints(uiSourceCode);
+        var uiBreakpoints = uiSourceCode.breakpoints();
         for (var lineNumber in uiBreakpoints) {
             var uiBreakpoint = uiBreakpoints[lineNumber];
             this._removeBreakpointFromUI(uiBreakpoint);
@@ -97,22 +94,13 @@
 
     /**
      * @param {WebInspector.UISourceCode} uiSourceCode
-     * @return {Object.<string,WebInspector.UIBreakpoint>|undefined}
-     */
-    breakpointsForUISourceCode: function(uiSourceCode)
-    {
-        return this._uiBreakpoints(uiSourceCode);
-    },
-
-    /**
-     * @param {WebInspector.UISourceCode} uiSourceCode
      * @param {number} lineNumber
      * @param {string} condition
      * @param {boolean} enabled
      */
     setBreakpoint: function(uiSourceCode, lineNumber, condition, enabled)
     {
-        if (this._uiBreakpoint(uiSourceCode, lineNumber))
+        if (uiSourceCode.breakpoints()[lineNumber])
             return;
         var breakpoint = new WebInspector.Breakpoint(uiSourceCode.id, lineNumber, condition, enabled, !!uiSourceCode.url);
         this._addBreakpointToModel(breakpoint);
@@ -126,7 +114,7 @@
      */
     removeBreakpoint: function(uiSourceCode, lineNumber)
     {
-        var uiBreakpoint = this._uiBreakpoint(uiSourceCode, lineNumber);
+        var uiBreakpoint = uiSourceCode.breakpoints()[lineNumber];
         if (!uiBreakpoint)
             return;
         this._innerRemoveBreakpoint(uiBreakpoint.breakpoint);
@@ -204,35 +192,14 @@
     },
 
     /**
-     * @param {WebInspector.UISourceCode} uiSourceCode
-     * @return {?Object.<string,WebInspector.UIBreakpoint>}
-     */
-    _uiBreakpoints: function(uiSourceCode)
-    {
-        if (!this._uiBreakpointsByUILocation.get(uiSourceCode))
-            this._uiBreakpointsByUILocation.put(uiSourceCode, {});
-        return this._uiBreakpointsByUILocation.get(uiSourceCode);
-    },
-
-    /**
-     * @param {WebInspector.UISourceCode} uiSourceCode
-     * @param {number} lineNumber
-     * @return {?WebInspector.UIBreakpoint}
-     */
-    _uiBreakpoint: function(uiSourceCode, lineNumber)
-    {
-        return this._uiBreakpoints(uiSourceCode)[String(lineNumber)];
-    },
-
-    /**
      * @param {WebInspector.Breakpoint} breakpoint
      * @param {WebInspector.UISourceCode} uiSourceCode
      */
     _addBreakpointToUI: function(breakpoint, uiSourceCode)
     {
         var uiBreakpoint = breakpoint.createUIBreakpoint(uiSourceCode);
-        console.assert(!this._uiBreakpoint(uiBreakpoint.uiSourceCode, uiBreakpoint.lineNumber));
-        this._uiBreakpoints(uiBreakpoint.uiSourceCode)[uiBreakpoint.lineNumber] = uiBreakpoint;
+        console.assert(!uiSourceCode.breakpoints()[uiBreakpoint.lineNumber]);
+        uiSourceCode.breakpointAdded(uiBreakpoint.lineNumber, uiBreakpoint);
         this._breakpointAddedDelegate(uiBreakpoint);
     },
 
@@ -241,8 +208,10 @@
      */
     _removeBreakpointFromUI: function(uiBreakpoint)
     {
-        console.assert(this._uiBreakpoint(uiBreakpoint.uiSourceCode, uiBreakpoint.lineNumber) === uiBreakpoint);
-        delete this._uiBreakpoints(uiBreakpoint.uiSourceCode)[uiBreakpoint.lineNumber];
+        var uiSourceCode = uiBreakpoint.uiSourceCode;
+        var lineNumber = uiBreakpoint.lineNumber;
+        console.assert(uiSourceCode.breakpoints()[lineNumber] === uiBreakpoint);
+        uiSourceCode.breakpointRemoved(lineNumber);
         uiBreakpoint.breakpoint.removeUIBreakpoint();
         this._breakpointRemovedDelegate(uiBreakpoint);
     },
@@ -416,7 +385,6 @@
             if (empty)
                 delete this._breakpointsByUILocation[id];
         }
-        this._uiBreakpointsByUILocation = new Map();
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js (112235 => 112236)


--- trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js	2012-03-27 09:55:18 UTC (rev 112236)
@@ -117,7 +117,7 @@
                 contentProvider = new WebInspector.StaticContentProvider("text/_javascript_", sourceContent);
             else
                 contentProvider = new WebInspector.CompilerSourceMappingContentProvider(sourceURL);
-            var uiSourceCode = new WebInspector.UISourceCode(sourceURL, sourceURL, contentProvider);
+            var uiSourceCode = new WebInspector.UISourceCodeImpl(sourceURL, sourceURL, contentProvider);
             uiSourceCode.isContentScript = script.isContentScript;
             uiSourceCode.isEditable = false;
             this._uiSourceCodeByURL[sourceURL] = uiSourceCode;

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (112235 => 112236)


--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2012-03-27 09:55:18 UTC (rev 112236)
@@ -220,7 +220,7 @@
      */
     _updateBreakpointsAfterLiveEdit: function(uiSourceCode, oldSource, newSource)
     {
-        var breakpoints = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode);
+        var breakpoints = uiSourceCode.breakpoints();
 
         // Clear and re-create breakpoints according to text diff.
         var diff = Array.diff(oldSource.split("\n"), newSource.split("\n"));
@@ -351,7 +351,7 @@
      */
     breakpointsForUISourceCode: function(uiSourceCode)
     {
-        var breakpointsMap = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode);
+        var breakpointsMap = uiSourceCode.breakpoints();
         var breakpointsList = [];
         for (var lineNumber in breakpointsMap)
             breakpointsList.push(breakpointsMap[lineNumber]);
@@ -433,7 +433,7 @@
      */
     findBreakpoint: function(uiSourceCode, lineNumber)
     {
-        return this._breakpointManager.breakpointsForUISourceCode(uiSourceCode)[String(lineNumber)];
+        return uiSourceCode.breakpoints()[lineNumber];
     },
 
     /**
@@ -571,8 +571,44 @@
 
 WebInspector.DebuggerPresentationModel.prototype.__proto__ = WebInspector.Object.prototype;
 
+
 /**
  * @constructor
+ * @extends {WebInspector.UISourceCode}
+ * @param {string} id
+ * @param {string} url
+ * @param {WebInspector.ContentProvider} contentProvider
+ */
+WebInspector.UISourceCodeImpl = function(id, url, contentProvider)
+{
+    WebInspector.UISourceCode.call(this, id, url, contentProvider);
+    /**
+     * @type {Object.<string,WebInspector.UIBreakpoint>}
+     */
+    this._breakpoints = {};
+}
+
+WebInspector.UISourceCodeImpl.prototype = {
+    breakpoints: function()
+    {
+        return this._breakpoints;
+    },
+
+    breakpointAdded: function(lineNumber, breakpoint)
+    {
+        this._breakpoints[lineNumber] = breakpoint;
+    },
+
+    breakpointRemoved: function(lineNumber)
+    {
+        delete this._breakpoints[lineNumber];
+    }
+}
+
+WebInspector.UISourceCodeImpl.prototype.__proto__ = WebInspector.UISourceCode.prototype;
+
+/**
+ * @constructor
  * @param {WebInspector.UISourceCode} uiSourceCode
  * @param {number} lineNumber
  * @param {WebInspector.ConsoleMessage} originalMessage

Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (112235 => 112236)


--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2012-03-27 09:55:18 UTC (rev 112236)
@@ -212,7 +212,7 @@
      */
     _createUISourceCode: function(id, url, contentProvider)
     {
-        var uiSourceCode = new WebInspector.UISourceCode(id, url, contentProvider);
+        var uiSourceCode = new WebInspector.UISourceCodeImpl(id, url, contentProvider);
         uiSourceCode.isContentScript = this.isContentScript;
         uiSourceCode.isEditable = this._scripts.length === 1 && !this._scripts[0].lineOffset && !this._scripts[0].columnOffset && !this._formatted;
         return uiSourceCode;

Modified: trunk/Source/WebCore/inspector/front-end/SnippetsModel.js (112235 => 112236)


--- trunk/Source/WebCore/inspector/front-end/SnippetsModel.js	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/Source/WebCore/inspector/front-end/SnippetsModel.js	2012-03-27 09:55:18 UTC (rev 112236)
@@ -375,7 +375,7 @@
         var snippet = /** @type {WebInspector.Snippet} */ event.data;
         var uiSourceCodeId = ""; // FIXME: to be implemented.
         var uiSourceCodeURL = ""; // FIXME: to be implemented.
-        var uiSourceCode = new WebInspector.UISourceCode(uiSourceCodeId, uiSourceCodeURL, new WebInspector.SnippetContentProvider(snippet));
+        var uiSourceCode = new WebInspector.UISourceCodeImpl(uiSourceCodeId, uiSourceCodeURL, new WebInspector.SnippetContentProvider(snippet));
         uiSourceCode.isSnippet = true;
         uiSourceCode.isEditable = true;
         this._uiSourceCodeForSnippet.put(snippet, uiSourceCode);
@@ -398,7 +398,7 @@
      */
     _createUISourceCodeForScript: function(script)
     {
-        var uiSourceCode = new WebInspector.UISourceCode(script.sourceURL, script.sourceURL, new WebInspector.ScriptContentProvider(script));
+        var uiSourceCode = new WebInspector.UISourceCodeImpl(script.sourceURL, script.sourceURL, new WebInspector.ScriptContentProvider(script));
         uiSourceCode.isSnippetEvaluation = true;
         var oldUISourceCode = this._uiSourceCodeForScriptId[script.scriptId];
         this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode;

Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (112235 => 112236)


--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-03-27 09:55:18 UTC (rev 112236)
@@ -112,10 +112,10 @@
     {
         if (typeof(this._domain) === "undefined")
             this._parseURL();
-        
+
         return this._domain;
     },
-    
+
     /**
      * @type {string}
      */
@@ -123,10 +123,10 @@
     {
         if (typeof(this._folderName) === "undefined")
             this._parseURL();
-        
+
         return this._folderName;
     },
-    
+
     /**
      * @type {string}
      */
@@ -134,10 +134,10 @@
     {
         if (typeof(this._fileName) === "undefined")
             this._parseURL();
-        
+
         return this._fileName;
     },
-    
+
     /**
      * @type {string}
      */
@@ -145,10 +145,10 @@
     {
         if (typeof(this._displayName) === "undefined")
             this._parseURL();
-        
+
         return this._displayName;
     },
-    
+
     _parseURL: function()
     {
         var parsedURL = this.url.asParsedURL();
@@ -172,10 +172,10 @@
             indexOfQuery = fileName.length;
         var lastPathComponent = fileName.substring(0, indexOfQuery);
         var queryParams = fileName.substring(indexOfQuery, fileName.length);
-        
+
         const maxDisplayNameLength = 30;
         const minDisplayQueryParamLength = 5;
-        
+
         var maxDisplayQueryParamLength = Math.max(minDisplayQueryParamLength, maxDisplayNameLength - lastPathComponent.length);
         var displayQueryParams = queryParams.trimEnd(maxDisplayQueryParamLength);
         var displayLastPathComponent = lastPathComponent.trimMiddle(maxDisplayNameLength - displayQueryParams.length);
@@ -205,7 +205,9 @@
         for (var i = 0; i < this._requestContentCallbacks.length; ++i)
             this._requestContentCallbacks[i](mimeType, content);
         this._requestContentCallbacks = [];
-    }
+    },
+
+    breakpoints: function() {}
 }
 
 WebInspector.UISourceCode.prototype.__proto__ = WebInspector.Object.prototype;

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (112235 => 112236)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2012-03-27 09:48:21 UTC (rev 112235)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2012-03-27 09:55:18 UTC (rev 112236)
@@ -169,9 +169,9 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
-    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to