Title: [109899] trunk
Revision
109899
Author
podivi...@chromium.org
Date
2012-03-06 04:11:05 -0800 (Tue, 06 Mar 2012)

Log Message

Web Inspector: remove reference to RawSourceCode from UISourceCode.
https://bugs.webkit.org/show_bug.cgi?id=80395

Reviewed by Vsevolod Vlasov.

Source/WebCore:

* inspector/compile-front-end.sh:
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel):
(WebInspector.DebuggerPresentationModel.prototype._handleUISourceCodeListChanged):
(WebInspector.DebuggerPresentationModel.prototype._uiSourceCodeListChanged):
(WebInspector.DebuggerPresentationModel.prototype._restoreBreakpoints):
(WebInspector.DebuggerPresentationModel.prototype.setScriptSource.didEditScriptSource):
(WebInspector.DebuggerPresentationModel.prototype.setScriptSource):
(WebInspector.DebuggerPresentationModel.prototype.continueToLine):
(WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
* inspector/front-end/RawSourceCode.js:
(WebInspector.RawSourceCode.prototype._createUISourceCode):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode):

LayoutTests:

* inspector/debugger/raw-source-code.html:
* inspector/debugger/ui-source-code.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (109898 => 109899)


--- trunk/LayoutTests/ChangeLog	2012-03-06 12:09:18 UTC (rev 109898)
+++ trunk/LayoutTests/ChangeLog	2012-03-06 12:11:05 UTC (rev 109899)
@@ -1,3 +1,13 @@
+2012-03-06  Pavel Podivilov  <podivi...@chromium.org>
+
+        Web Inspector: remove reference to RawSourceCode from UISourceCode.
+        https://bugs.webkit.org/show_bug.cgi?id=80395
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/debugger/raw-source-code.html:
+        * inspector/debugger/ui-source-code.html:
+
 2012-03-06  Ádám Kallai  <ka...@inf.u-szeged.hu>
 
         [Qt] Gardening, skip some failing tests.

Modified: trunk/LayoutTests/inspector/debugger/raw-source-code.html (109898 => 109899)


--- trunk/LayoutTests/inspector/debugger/raw-source-code.html	2012-03-06 12:09:18 UTC (rev 109898)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code.html	2012-03-06 12:11:05 UTC (rev 109899)
@@ -109,7 +109,6 @@
             var uiSourceCode = rawSourceCode.uiSourceCodeList()[0];
             InspectorTest.assertEquals("foo.js", uiSourceCode.url);
             InspectorTest.assertEquals(true, uiSourceCode.isContentScript);
-            InspectorTest.assertEquals(rawSourceCode, uiSourceCode.rawSourceCode);
             checkUILocation(uiSourceCode, 0, 5, rawSourceCode.rawLocationToUILocation(createRawLocation(0, 5)));
             checkRawLocation(script, 10, 0, rawSourceCode.uiLocationToRawLocation(uiSourceCode, 10, 0));
             uiSourceCode.requestContent(didRequestContent);

Modified: trunk/LayoutTests/inspector/debugger/ui-source-code.html (109898 => 109899)


--- trunk/LayoutTests/inspector/debugger/ui-source-code.html	2012-03-06 12:09:18 UTC (rev 109898)
+++ trunk/LayoutTests/inspector/debugger/ui-source-code.html	2012-03-06 12:11:05 UTC (rev 109899)
@@ -17,7 +17,7 @@
     InspectorTest.runTestSuite([
         function testUISourceCode(next)
         {
-            var uiSourceCode = new WebInspector.UISourceCode("id", "url", null, contentProvider);
+            var uiSourceCode = new WebInspector.UISourceCode("id", "url", contentProvider);
             function didRequestContent(callNumber, mimeType, content)
             {
                 InspectorTest.addResult("Callback " + callNumber + " is invoked.");

Modified: trunk/Source/WebCore/ChangeLog (109898 => 109899)


--- trunk/Source/WebCore/ChangeLog	2012-03-06 12:09:18 UTC (rev 109898)
+++ trunk/Source/WebCore/ChangeLog	2012-03-06 12:11:05 UTC (rev 109899)
@@ -1,3 +1,25 @@
+2012-03-06  Pavel Podivilov  <podivi...@chromium.org>
+
+        Web Inspector: remove reference to RawSourceCode from UISourceCode.
+        https://bugs.webkit.org/show_bug.cgi?id=80395
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/compile-front-end.sh:
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel):
+        (WebInspector.DebuggerPresentationModel.prototype._handleUISourceCodeListChanged):
+        (WebInspector.DebuggerPresentationModel.prototype._uiSourceCodeListChanged):
+        (WebInspector.DebuggerPresentationModel.prototype._restoreBreakpoints):
+        (WebInspector.DebuggerPresentationModel.prototype.setScriptSource.didEditScriptSource):
+        (WebInspector.DebuggerPresentationModel.prototype.setScriptSource):
+        (WebInspector.DebuggerPresentationModel.prototype.continueToLine):
+        (WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
+        * inspector/front-end/RawSourceCode.js:
+        (WebInspector.RawSourceCode.prototype._createUISourceCode):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UISourceCode):
+
 2012-03-06  Andrey Kosyakov  <ca...@chromium.org>
 
         Web Inspector: move timeline panel overview mode toggle buttons to overview sidebar tree

Modified: trunk/Source/WebCore/inspector/compile-front-end.sh (109898 => 109899)


--- trunk/Source/WebCore/inspector/compile-front-end.sh	2012-03-06 12:09:18 UTC (rev 109898)
+++ trunk/Source/WebCore/inspector/compile-front-end.sh	2012-03-06 12:11:05 UTC (rev 109899)
@@ -45,7 +45,7 @@
         --js Source/WebCore/inspector/front-end/UserMetrics.js \
         --js Source/WebCore/inspector/front-end/HandlerRegistry.js \
         --js Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js \
-    --module jsmodule_sdk:33:jsmodule_common \
+    --module jsmodule_sdk:34:jsmodule_common \
         --js Source/WebCore/inspector/front-end/InspectorBackend.js \
         --js Source/WebCore/inspector/front-end/ApplicationCacheModel.js \
         --js Source/WebCore/inspector/front-end/Color.js \
@@ -68,6 +68,7 @@
         --js Source/WebCore/inspector/front-end/Placard.js \
         --js Source/WebCore/inspector/front-end/Script.js \
         --js Source/WebCore/inspector/front-end/ScriptFormatter.js \
+        --js Source/WebCore/inspector/front-end/ScriptMapping.js \
         --js Source/WebCore/inspector/front-end/TimelineManager.js \
         --js Source/WebCore/inspector/front-end/TimelineModel.js \
         --js Source/WebCore/inspector/front-end/TimelinePresentationModel.js \

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


--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2012-03-06 12:09:18 UTC (rev 109898)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2012-03-06 12:11:05 UTC (rev 109899)
@@ -40,6 +40,7 @@
     this._rawSourceCodeForScriptId = {};
     this._rawSourceCodeForURL = {};
     this._rawSourceCodeForDocumentURL = {};
+    this._rawSourceCodeForUISourceCode = new Map();
     this._presentationCallFrames = [];
 
     this._breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this._breakpointAdded.bind(this), this._breakpointRemoved.bind(this), WebInspector.debuggerModel, this);
@@ -112,7 +113,8 @@
      */
     uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
     {
-        return uiSourceCode.rawSourceCode.uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber);
+        var rawSourceCode = this._rawSourceCodeForUISourceCode.get(uiSourceCode);
+        return rawSourceCode.uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber);
     },
 
     /**
@@ -167,7 +169,7 @@
         this._addPendingConsoleMessagesToScript(script);
 
         if (rawSourceCode.uiSourceCodeList().length)
-            this._uiSourceCodeListChanged(rawSourceCode, []);
+            this._uiSourceCodeListChanged(rawSourceCode, [], rawSourceCode.uiSourceCodeList());
         rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.UISourceCodeListChanged, this._handleUISourceCodeListChanged, this);
     },
 
@@ -202,17 +204,23 @@
     {
         var rawSourceCode = /** @type {WebInspector.RawSourceCode} */ event.target;
         var oldUISourceCodeList = /** @type {Array.<WebInspector.UISourceCode>} */ event.data["oldUISourceCodeList"];
-        this._uiSourceCodeListChanged(rawSourceCode, oldUISourceCodeList);
+        this._uiSourceCodeListChanged(rawSourceCode, oldUISourceCodeList, rawSourceCode.uiSourceCodeList());
     },
 
     /**
      * @param {WebInspector.RawSourceCode} rawSourceCode
-     * @param {Array.<WebInspector.UISourceCode>} oldUISourceCodeList
+     * @param {Array.<WebInspector.UISourceCode>} removedItems
+     * @param {Array.<WebInspector.UISourceCode>} addedItems
      */
-    _uiSourceCodeListChanged: function(rawSourceCode, oldUISourceCodeList)
+    _uiSourceCodeListChanged: function(rawSourceCode, removedItems, addedItems)
     {
-        for (var i = 0; i < oldUISourceCodeList.length; ++i) {
-            var breakpoints = this._breakpointManager.breakpointsForUISourceCode(oldUISourceCodeList[i]);
+        for (var i = 0; i < removedItems.length; ++i)
+            this._rawSourceCodeForUISourceCode.remove(removedItems[i]);
+        for (var i = 0; i < addedItems.length; ++i)
+            this._rawSourceCodeForUISourceCode.put(addedItems[i], rawSourceCode);
+
+        for (var i = 0; i < removedItems.length; ++i) {
+            var breakpoints = this._breakpointManager.breakpointsForUISourceCode(removedItems[i]);
             for (var lineNumber in breakpoints) {
                 var breakpoint = breakpoints[lineNumber];
                 this._breakpointRemoved(breakpoint);
@@ -220,24 +228,25 @@
             }
         }
 
-        this._restoreBreakpoints(rawSourceCode);
+        this._restoreBreakpoints(addedItems);
 
-        var uiSourceCodeList = rawSourceCode.uiSourceCodeList();
-        if (!oldUISourceCodeList.length) {
-            for (var i = 0; i < uiSourceCodeList.length; ++i)
-                this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, uiSourceCodeList[i]);
+        if (!removedItems.length) {
+            for (var i = 0; i < addedItems.length; ++i)
+                this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, addedItems[i]);
+        } else if (!addedItems.length) {
+            for (var i = 0; i < addedItems.length; ++i)
+                this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, removedItems[i]);
         } else {
-            var eventData = { uiSourceCodeList: uiSourceCodeList, oldUISourceCodeList: oldUISourceCodeList };
+            var eventData = { uiSourceCodeList: addedItems, oldUISourceCodeList: removedItems };
             this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, eventData);
         }
     },
 
     /**
-     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @param {Array.<WebInspector.UISourceCode>} uiSourceCodeList
      */
-    _restoreBreakpoints: function(rawSourceCode)
+    _restoreBreakpoints: function(uiSourceCodeList)
     {
-        var uiSourceCodeList = rawSourceCode.uiSourceCodeList();
         for (var i = 0; i < uiSourceCodeList.length; ++i) {
             var uiSourceCode = uiSourceCodeList[i];
             this._breakpointManager.uiSourceCodeAdded(uiSourceCode);
@@ -263,8 +272,8 @@
      */
     setScriptSource: function(uiSourceCode, newSource, callback)
     {
-        var rawSourceCode = uiSourceCode.rawSourceCode;
-        var script = this._scriptForRawSourceCode(rawSourceCode);
+        var rawLocation = this.uiLocationToRawLocation(uiSourceCode, 0, 0);
+        var script = WebInspector.debuggerModel.scriptForSourceID(rawLocation.scriptId);
 
         /**
          * @this {WebInspector.DebuggerPresentationModel}
@@ -276,7 +285,7 @@
             if (error)
                 return;
 
-            var resource = WebInspector.resourceForURL(rawSourceCode.url);
+            var resource = WebInspector.resourceForURL(script.sourceURL);
             if (resource)
                 resource.addRevision(newSource);
 
@@ -421,7 +430,7 @@
      */
     continueToLine: function(uiSourceCode, lineNumber)
     {
-        var rawLocation = uiSourceCode.rawSourceCode.uiLocationToRawLocation(uiSourceCode, lineNumber, 0);
+        var rawLocation = this.uiLocationToRawLocation(uiSourceCode, lineNumber, 0);
         WebInspector.debuggerModel.continueToLocation(rawLocation);
     },
 
@@ -568,7 +577,7 @@
         if (this._executionLineLiveLocation)
             this._executionLineLiveLocation.dispose();
         delete this._executionLineLiveLocation;
-        
+
         this._selectedCallFrame = callFrame;
         if (!this._selectedCallFrame)
             return;
@@ -658,23 +667,6 @@
     },
 
     /**
-     * @param {WebInspector.RawSourceCode} rawSourceCode
-     */
-    _scriptForRawSourceCode: function(rawSourceCode)
-    {
-        /**
-         * @this {WebInspector.DebuggerPresentationModel}
-         * @param {WebInspector.Script} script
-         * @return {boolean}
-         */
-        function filter(script)
-        {
-            return script.scriptId === rawSourceCode.id;
-        }
-        return WebInspector.debuggerModel.queryScripts(filter.bind(this))[0];
-    },
-
-    /**
      * @param {string} url
      * @param {DebuggerAgent.Location} rawLocation
      * @return {WebInspector.Script}
@@ -697,15 +689,14 @@
     {
         for (var i = 0; i < this._rawSourceCodes.length; ++i) {
             var rawSourceCode = this._rawSourceCodes[i];
-            var uiSourceCodeList = rawSourceCode.uiSourceCodeList();
-            for (var j = 0; j < uiSourceCodeList.length; ++j)
-                this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, uiSourceCodeList[j]);
+            this._uiSourceCodeListChanged(rawSourceCode, rawSourceCode.uiSourceCodeList(), []);
             rawSourceCode.removeAllListeners();
         }
         this._rawSourceCodes = [];
         this._rawSourceCodeForScriptId = {};
         this._rawSourceCodeForURL = {};
         this._rawSourceCodeForDocumentURL = {};
+        this._rawSourceCodeForUISourceCode.clear();
         this._presentationCallFrames = [];
         this._selectedCallFrame = null;
         this._breakpointManager.debuggerReset();

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


--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2012-03-06 12:09:18 UTC (rev 109898)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2012-03-06 12:11:05 UTC (rev 109899)
@@ -261,7 +261,7 @@
      */
     _createUISourceCode: function(id, url, contentProvider)
     {
-        var uiSourceCode = new WebInspector.UISourceCode(id, url, this, contentProvider);
+        var uiSourceCode = new WebInspector.UISourceCode(id, url, contentProvider);
         uiSourceCode.isContentScript = this.isContentScript;
         uiSourceCode.isEditable = this._scripts.length === 1 && !this._scripts[0].lineOffset && !this._scripts[0].columnOffset
                                   && !this._formatted && !this._compilerSourceMapping;

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


--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-03-06 12:09:18 UTC (rev 109898)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-03-06 12:11:05 UTC (rev 109899)
@@ -33,14 +33,12 @@
  * @extends {WebInspector.Object}
  * @param {string} id
  * @param {string} url
- * @param {WebInspector.RawSourceCode} rawSourceCode
  * @param {WebInspector.ContentProvider} contentProvider
  */
-WebInspector.UISourceCode = function(id, url, rawSourceCode, contentProvider)
+WebInspector.UISourceCode = function(id, url, contentProvider)
 {
     this._id = id;
     this._url = url;
-    this._rawSourceCode = rawSourceCode;
     this._contentProvider = contentProvider;
     this.isContentScript = false;
     this.isEditable = false;
@@ -72,14 +70,6 @@
     },
 
     /**
-     * @return {WebInspector.RawSourceCode}
-     */
-    get rawSourceCode()
-    {
-        return this._rawSourceCode;
-    },
-
-    /**
      * @param {function(string,string)} callback
      */
     requestContent: function(callback)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to