Title: [117267] trunk
Revision
117267
Author
[email protected]
Date
2012-05-16 05:22:29 -0700 (Wed, 16 May 2012)

Log Message

Web Inspector: get rid of UISourceCodeListChanged event.
https://bugs.webkit.org/show_bug.cgi?id=86601

Reviewed by Vsevolod Vlasov.

Source/WebCore:

There was unnecessary conversion between this event and UISourceCodeAdded/Removed/Replaced.

* inspector/front-end/CompilerScriptMapping.js:
(WebInspector.CompilerScriptMapping.prototype.reset):
* inspector/front-end/DebuggerScriptMapping.js:
(WebInspector.DebuggerScriptMapping):
(WebInspector.DebuggerScriptMapping.prototype._handleUISourceCodeAdded):
(WebInspector.DebuggerScriptMapping.prototype._handleUISourceCodeReplaced):
(WebInspector.DebuggerScriptMapping.prototype._handleUISourceCodeRemoved):
* inspector/front-end/NavigatorView.js:
* inspector/front-end/ResourceScriptMapping.js:
(WebInspector.ResourceScriptMapping.prototype.addScript):
(WebInspector.ResourceScriptMapping.prototype._handleUISourceCodeChanged):
(WebInspector.ResourceScriptMapping.prototype._uiSourceCodeAdded):
(WebInspector.ResourceScriptMapping.prototype._uiSourceCodeReplaced):
(WebInspector.ResourceScriptMapping.prototype._uiSourceCodeRemoved):
(WebInspector.ResourceScriptMapping.prototype.reset):
* inspector/front-end/ScriptMapping.js:
* inspector/front-end/ScriptSnippetModel.js:
(WebInspector.ScriptSnippetModel.prototype._addScriptSnippet):
(WebInspector.ScriptSnippetModel.prototype._createUISourceCodeForScript):
(WebInspector.ScriptSnippetModel.prototype._reset):
(WebInspector.SnippetScriptMapping.prototype._fireUISourceCodeAdded):
(WebInspector.SnippetScriptMapping.prototype._fireUISourceCodeRemoved):
* inspector/front-end/ScriptsNavigator.js:
(WebInspector.ScriptsNavigator.prototype.replaceUISourceCode):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._uiSourceCodeReplaced):
* inspector/front-end/TabbedEditorContainer.js:

LayoutTests:

* http/tests/inspector/compiler-script-mapping.html:
* inspector/debugger/scripts-panel.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117266 => 117267)


--- trunk/LayoutTests/ChangeLog	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/LayoutTests/ChangeLog	2012-05-16 12:22:29 UTC (rev 117267)
@@ -1,3 +1,13 @@
+2012-05-16  Pavel Feldman  <[email protected]>
+
+        Web Inspector: get rid of UISourceCodeListChanged event.
+        https://bugs.webkit.org/show_bug.cgi?id=86601
+
+        Reviewed by Vsevolod Vlasov.
+
+        * http/tests/inspector/compiler-script-mapping.html:
+        * inspector/debugger/scripts-panel.html:
+
 2012-05-16  Yury Semikhatsky  <[email protected]>
 
         [chromium] Layout tests under inspector/profiler are failing on chromium win

Modified: trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html (117266 => 117267)


--- trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html	2012-05-16 12:22:29 UTC (rev 117267)
@@ -193,7 +193,7 @@
             WebInspector.settings.sourceMapsEnabled.set(true);
             WebInspector.debuggerModel._reset();
             var debuggerScriptMapping = new WebInspector.DebuggerScriptMapping();
-            debuggerScriptMapping.addEventListener(WebInspector.DebuggerScriptMapping.Events.UISourceCodeAdded, uiSourceCodeAdded);
+            debuggerScriptMapping.addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeAdded, uiSourceCodeAdded);
 
             var script = InspectorTest.createScriptMock("compiled.js", 0, 0, true, "");
             script.sourceMapURL = "http://localhost:8000/inspector/resources/source-map.json_";

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt (117266 => 117267)


--- trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2012-05-16 12:22:29 UTC (rev 117267)
@@ -28,14 +28,6 @@
 Dumping ScriptsNavigator 'Content scripts' tab:
 Dumping ScriptsNavigator 'Scripts' tab:
   foo.js
-  source1.js
-  source2.js
+  source.js
 Dumping ScriptsNavigator 'Content scripts' tab:
-Source requested for source2.js
-Source requested for source1.js
-Source requested for compiled.js
-Dumping ScriptsNavigator 'Scripts' tab:
-  compiled.js
-  foo.js
-Dumping ScriptsNavigator 'Content scripts' tab:
 

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (117266 => 117267)


--- trunk/LayoutTests/inspector/debugger/scripts-panel.html	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html	2012-05-16 12:22:29 UTC (rev 117267)
@@ -29,21 +29,19 @@
         model._addUISourceCode = function(uiSourceCode)
         {
             uiSourceCodes.push(uiSourceCode);
-            this.dispatchEventToListeners(WebInspector.DebuggerScriptMapping.Events.UISourceCodeAdded, uiSourceCode);
+            this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeAdded, uiSourceCode);
         }
         model._reset = function(preservedItems)
         {
             uiSourceCodes = preservedItems || [];
             WebInspector.debuggerModel.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalObjectCleared);
         }
-        model._replaceUISourceCodes = function(oldUISourceCodeList, newUISourceCodeList)
+        model._replaceUISourceCode = function(oldUISourceCode, uiSourceCode)
         {
-            for (var i = 0; i < oldUISourceCodeList.length; ++i)
-              uiSourceCodes.remove(oldUISourceCodeList[i]);
-            for (var i = 0; i < newUISourceCodeList.length; ++i)
-              uiSourceCodes.push(newUISourceCodeList[i]);
-            var data = { oldUISourceCodeList: oldUISourceCodeList, uiSourceCodeList: newUISourceCodeList };
-            this.dispatchEventToListeners(WebInspector.DebuggerScriptMapping.Events.UISourceCodeReplaced, data);
+            uiSourceCodes.remove(oldUISourceCode);
+            uiSourceCodes.push(uiSourceCode);
+            var data = { oldUISourceCode: oldUISourceCode, uiSourceCode: uiSourceCode };
+            this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeReplaced, data);
         }
         return model;
     }
@@ -109,7 +107,6 @@
             next();
         },
 
-
         function testSourceReplaced(next)
         {
             var mapping = createDebuggerScriptMappingMock();
@@ -124,25 +121,11 @@
             InspectorTest.dumpScriptsNavigator(panel._navigator);
 
             // Plug compiler source mapping.
-            var source1SourceCode = createUISouceCode("source1.js");
-            var source2SourceCode = createUISouceCode("source2.js");
-            mapping._replaceUISourceCodes([compiledSourceCode], [source1SourceCode, source2SourceCode]);
+            var sourceSourceCode = createUISouceCode("source.js");
+            mapping._replaceUISourceCode(compiledSourceCode, sourceSourceCode);
 
             InspectorTest.dumpScriptsNavigator(panel._navigator);
-            InspectorTest.showScriptSourceOnScriptsPanel(panel, "source2.js", step2);
-
-            function step2() {
-                InspectorTest.showScriptSourceOnScriptsPanel(panel, "source1.js", step3);
-            }
-
-            function step3() {
-                // Unplug compiler source mapping.
-                mapping._replaceUISourceCodes([source1SourceCode, source2SourceCode], [compiledSourceCode]);
-                InspectorTest.dumpScriptsNavigator(panel._navigator);
-
-                panel.detach();
-                next();
-            }
+            next();
         }
     ]);
 };

Modified: trunk/Source/WebCore/ChangeLog (117266 => 117267)


--- trunk/Source/WebCore/ChangeLog	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/ChangeLog	2012-05-16 12:22:29 UTC (rev 117267)
@@ -1,3 +1,40 @@
+2012-05-16  Pavel Feldman  <[email protected]>
+
+        Web Inspector: get rid of UISourceCodeListChanged event.
+        https://bugs.webkit.org/show_bug.cgi?id=86601
+
+        Reviewed by Vsevolod Vlasov.
+
+        There was unnecessary conversion between this event and UISourceCodeAdded/Removed/Replaced.
+
+        * inspector/front-end/CompilerScriptMapping.js:
+        (WebInspector.CompilerScriptMapping.prototype.reset):
+        * inspector/front-end/DebuggerScriptMapping.js:
+        (WebInspector.DebuggerScriptMapping):
+        (WebInspector.DebuggerScriptMapping.prototype._handleUISourceCodeAdded):
+        (WebInspector.DebuggerScriptMapping.prototype._handleUISourceCodeReplaced):
+        (WebInspector.DebuggerScriptMapping.prototype._handleUISourceCodeRemoved):
+        * inspector/front-end/NavigatorView.js:
+        * inspector/front-end/ResourceScriptMapping.js:
+        (WebInspector.ResourceScriptMapping.prototype.addScript):
+        (WebInspector.ResourceScriptMapping.prototype._handleUISourceCodeChanged):
+        (WebInspector.ResourceScriptMapping.prototype._uiSourceCodeAdded):
+        (WebInspector.ResourceScriptMapping.prototype._uiSourceCodeReplaced):
+        (WebInspector.ResourceScriptMapping.prototype._uiSourceCodeRemoved):
+        (WebInspector.ResourceScriptMapping.prototype.reset):
+        * inspector/front-end/ScriptMapping.js:
+        * inspector/front-end/ScriptSnippetModel.js:
+        (WebInspector.ScriptSnippetModel.prototype._addScriptSnippet):
+        (WebInspector.ScriptSnippetModel.prototype._createUISourceCodeForScript):
+        (WebInspector.ScriptSnippetModel.prototype._reset):
+        (WebInspector.SnippetScriptMapping.prototype._fireUISourceCodeAdded):
+        (WebInspector.SnippetScriptMapping.prototype._fireUISourceCodeRemoved):
+        * inspector/front-end/ScriptsNavigator.js:
+        (WebInspector.ScriptsNavigator.prototype.replaceUISourceCode):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._uiSourceCodeReplaced):
+        * inspector/front-end/TabbedEditorContainer.js:
+
 2012-05-16  Keishi Hattori  <[email protected]>
 
         [chromium] Add WebKit API to access inner text value of input element

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


--- trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -126,9 +126,10 @@
 
         this._sourceMapForScriptId[script.scriptId] = sourceMap;
         this._scriptForSourceMap.put(sourceMap, script);
-        var data = { removedItems: [], addedItems: uiSourceCodeList };
-        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, data);
         script.setSourceMapping(this);
+
+        for (var i = 0; i < uiSourceCodeList.length; ++i)
+            this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeAdded, uiSourceCodeList[i]);
     },
 
     /**
@@ -159,8 +160,9 @@
 
     reset: function()
     {
-        var data = { removedItems: this.uiSourceCodeList(), addedItems: [] };
-        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, data);
+        var uiSourceCodes = this.uiSourceCodeList();
+        for (var i = 0; i < uiSourceCodes.length; ++i)
+            this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeRemoved, uiSourceCodes[i]);
 
         this._sourceMapByURL = {};
         this._sourceMapForScriptId = {};

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerScriptMapping.js (117266 => 117267)


--- trunk/Source/WebCore/inspector/front-end/DebuggerScriptMapping.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerScriptMapping.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -43,21 +43,17 @@
     this._mappings.push(this._compilerMapping);
     this._snippetMapping = WebInspector.scriptSnippetModel.scriptMapping;
     this._mappings.push(this._snippetMapping);
-  
-    for (var i = 0; i < this._mappings.length; ++i)
-        this._mappings[i].addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, this._handleUISourceCodeListChanged, this);
+    for (var i = 0; i < this._mappings.length; ++i) {
+        this._mappings[i].addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this);
+        this._mappings[i].addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeReplaced, this._handleUISourceCodeReplaced, this);
+        this._mappings[i].addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeRemoved, this._handleUISourceCodeRemoved, this);
+    }
 
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this);
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScriptSource, this);
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
 }
 
-WebInspector.DebuggerScriptMapping.Events = {
-    UISourceCodeAdded: "source-file-added",
-    UISourceCodeReplaced: "source-file-replaced",
-    UISourceCodeRemoved: "source-file-removed"
-}
-
 WebInspector.DebuggerScriptMapping.prototype = {
     /**
      * @param {WebInspector.Event} event
@@ -86,24 +82,28 @@
     /**
      * @param {WebInspector.Event} event
      */
-    _handleUISourceCodeListChanged: function(event)
+    _handleUISourceCodeAdded: function(event)
     {
-        var removedItems = /** @type {Array.<WebInspector.UISourceCode>} */ event.data["removedItems"];
-        var addedItems = /** @type {Array.<WebInspector.UISourceCode>} */ event.data["addedItems"];
+        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeAdded, event.data);
+    },
 
-        if (!removedItems.length) {
-            for (var i = 0; i < addedItems.length; ++i)
-                this.dispatchEventToListeners(WebInspector.DebuggerScriptMapping.Events.UISourceCodeAdded, addedItems[i]);
-        } else if (!addedItems.length) {
-            for (var i = 0; i < addedItems.length; ++i)
-                this.dispatchEventToListeners(WebInspector.DebuggerScriptMapping.Events.UISourceCodeRemoved, removedItems[i]);
-        } else {
-            var eventData = { uiSourceCodeList: addedItems, oldUISourceCodeList: removedItems };
-            this.dispatchEventToListeners(WebInspector.DebuggerScriptMapping.Events.UISourceCodeReplaced, eventData);
-        }
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _handleUISourceCodeReplaced: function(event)
+    {
+        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeReplaced, event.data);
     },
 
     /**
+     * @param {WebInspector.Event} event
+     */
+    _handleUISourceCodeRemoved: function(event)
+    {
+        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeRemoved, event.data);
+    },
+
+    /**
      * @param {WebInspector.Script} script
      * @return {WebInspector.ScriptMapping}
      */

Modified: trunk/Source/WebCore/inspector/front-end/NavigatorView.js (117266 => 117267)


--- trunk/Source/WebCore/inspector/front-end/NavigatorView.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/NavigatorView.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -126,32 +126,26 @@
     },
 
     /**
-     * @param {Array.<WebInspector.UISourceCode>} oldUISourceCodeList
-     * @param {Array.<WebInspector.UISourceCode>} uiSourceCodeList
+     * @param {WebInspector.UISourceCode} oldUISourceCode
+     * @param {WebInspector.UISourceCode} uiSourceCode
      */
-    replaceUISourceCodes: function(oldUISourceCodeList, uiSourceCodeList)
+    replaceUISourceCode: function(oldUISourceCode, uiSourceCode)
     {
         var added = false;
         var selected = false;
-        for (var i = 0; i < oldUISourceCodeList.length; ++i) {
-            var uiSourceCode = oldUISourceCodeList[i];
-            if (!this._scriptTreeElementsByUISourceCode.get(uiSourceCode))
-                continue;
+        if (this._scriptTreeElementsByUISourceCode.get(oldUISourceCode)) {
             added = true;
 
-            if (this._lastSelectedUISourceCode === uiSourceCode)
+            if (this._lastSelectedUISourceCode === oldUISourceCode)
                 selected = true;
-            this._removeUISourceCode(uiSourceCode);
+            this._removeUISourceCode(oldUISourceCode);
         }
-        
+
         if (!added)
             return;
-            
-        for (var i = 0; i < uiSourceCodeList.length; ++i)
-            this.addUISourceCode(uiSourceCodeList[i]);
-
+        this.addUISourceCode(uiSourceCode);
         if (selected)
-            this.revealUISourceCode(uiSourceCodeList[0]);
+            this.revealUISourceCode(uiSourceCode);
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js (117266 => 117267)


--- trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -119,7 +119,7 @@
             this._rawSourceCodeForDocumentURL[script.sourceURL] = rawSourceCode;
 
         if (rawSourceCode.uiSourceCode())
-            this._uiSourceCodeChanged(rawSourceCode, null, rawSourceCode.uiSourceCode());
+            this._uiSourceCodeAdded(rawSourceCode, rawSourceCode.uiSourceCode());
         rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.UISourceCodeChanged, this._handleUISourceCodeChanged, this);
     },
 
@@ -131,34 +131,54 @@
         var rawSourceCode = /** @type {WebInspector.RawSourceCode} */ event.target;
         var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode;
         var oldUISourceCode = /** @type {WebInspector.UISourceCode} */ event.data.oldUISourceCode;
-        this._uiSourceCodeChanged(rawSourceCode, oldUISourceCode, uiSourceCode);
+        if (!oldUISourceCode)
+            this._uiSourceCodeAdded(rawSourceCode, uiSourceCode);
+        else
+            this._uiSourceCodeReplaced(rawSourceCode, oldUISourceCode, uiSourceCode);
     },
 
     /**
      * @param {WebInspector.RawSourceCode} rawSourceCode
-     * @param {WebInspector.UISourceCode} removedItem
-     * @param {WebInspector.UISourceCode} addedItem
+     * @paran {WebInspector.UISourceCode} uiSourceCode
      */
-    _uiSourceCodeChanged: function(rawSourceCode, removedItem, addedItem)
+    _uiSourceCodeAdded: function(rawSourceCode, uiSourceCode)
     {
-        if (removedItem)
-            this._rawSourceCodeForUISourceCode.remove(removedItem);
-        if (addedItem)
-            this._rawSourceCodeForUISourceCode.put(addedItem, rawSourceCode);
+        this._rawSourceCodeForUISourceCode.put(uiSourceCode, rawSourceCode);
 
-        var scriptIds = [];
-        for (var i = 0; i < rawSourceCode._scripts.length; ++i) {
-            scriptIds.push(rawSourceCode._scripts[i].scriptId);
+        for (var i = 0; i < rawSourceCode._scripts.length; ++i)
             rawSourceCode._scripts[i].setSourceMapping(this);
-        }
-        var removedItems = removedItem ? [removedItem] : [];
-        var addedItems = addedItem ? [addedItem] : [];
 
-        var data = { removedItems: removedItems, addedItems: addedItems };
-        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, data);
+        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeAdded, uiSourceCode);
     },
 
     /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @param {WebInspector.UISourceCode} oldUISourceCode
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     */
+    _uiSourceCodeReplaced: function(rawSourceCode, oldUISourceCode, uiSourceCode)
+    {
+        this._rawSourceCodeForUISourceCode.remove(oldUISourceCode);
+        this._rawSourceCodeForUISourceCode.put(uiSourceCode, rawSourceCode);
+
+        for (var i = 0; i < rawSourceCode._scripts.length; ++i)
+            rawSourceCode._scripts[i].setSourceMapping(this);
+
+        var data = { oldUISourceCode: uiSourceCode, uiSourceCode: uiSourceCode };
+        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeReplaced, data);
+    },
+
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @paran {WebInspector.UISourceCode} uiSourceCode
+     */
+    _uiSourceCodeRemoved: function(rawSourceCode, uiSourceCode)
+    {
+        this._rawSourceCodeForUISourceCode.remove(uiSourceCode);
+        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeRemoved, uiSourceCode);
+    },
+
+    /**
      * @param {WebInspector.Script} script
      * @param {WebInspector.RawSourceCode} rawSourceCode
      */
@@ -173,7 +193,7 @@
     {
         for (var i = 0; i < this._rawSourceCodes.length; ++i) {
             var rawSourceCode = this._rawSourceCodes[i];
-            this._uiSourceCodeChanged(rawSourceCode, rawSourceCode.uiSourceCode(), null);
+            this._uiSourceCodeRemoved(rawSourceCode, rawSourceCode.uiSourceCode());
             rawSourceCode.removeAllListeners();
         }
         this._rawSourceCodes = [];

Modified: trunk/Source/WebCore/inspector/front-end/ScriptMapping.js (117266 => 117267)


--- trunk/Source/WebCore/inspector/front-end/ScriptMapping.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/ScriptMapping.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -97,7 +97,9 @@
 }
 
 WebInspector.ScriptMapping.Events = {
-    UISourceCodeListChanged: "ui-source-code-list-changed"
+    UISourceCodeAdded: "UISourceCodeAdded",
+    UISourceCodeReplaced: "UISourceCodeReplaced",
+    UISourceCodeRemoved: "UISourceCodeRemoved"
 }
 
 WebInspector.ScriptMapping.prototype = {

Modified: trunk/Source/WebCore/inspector/front-end/ScriptSnippetModel.js (117266 => 117267)


--- trunk/Source/WebCore/inspector/front-end/ScriptSnippetModel.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/ScriptSnippetModel.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -81,7 +81,7 @@
         uiSourceCode.isEditable = true;
         this._uiSourceCodeForSnippet.put(snippet, uiSourceCode);
         this._snippetForUISourceCode.put(uiSourceCode, snippet);
-        this._snippetScriptMapping._uiSourceCodesAdded([uiSourceCode]);
+        this._snippetScriptMapping._fireUISourceCodeAdded(uiSourceCode);
         return uiSourceCode;
     },
 
@@ -95,7 +95,7 @@
         this._releaseSnippetScript(uiSourceCode);
         this._uiSourceCodeForSnippet.remove(snippet);
         this._snippetForUISourceCode.remove(uiSourceCode);
-        this._snippetScriptMapping._uiSourceCodesRemoved([uiSourceCode]);
+        this._snippetScriptMapping._fireUISourceCodeRemoved(uiSourceCode);
     },
 
     /**
@@ -219,7 +219,7 @@
         uiSourceCode.isSnippetEvaluation = true;
         this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode;
         this._scriptForUISourceCode.put(uiSourceCode, script);
-        this._snippetScriptMapping._uiSourceCodesAdded([uiSourceCode]);
+        this._snippetScriptMapping._fireUISourceCodeAdded(uiSourceCode);
         script.setSourceMapping(this._snippetScriptMapping);
     },
 
@@ -284,7 +284,8 @@
         var removedUISourceCodes = this._releasedUISourceCodes();
         this._uiSourceCodeForScriptId = {};
         this._scriptForUISourceCode = new Map();
-        this._snippetScriptMapping._uiSourceCodesRemoved(removedUISourceCodes);
+        for (var i = 0; i < removedUISourceCodes.length; ++i)
+            this._snippetScriptMapping._fireUISourceCodeRemoved(removedUISourceCodes[i]);
     }
 }
 
@@ -347,21 +348,19 @@
     },
 
     /**
-     * @param {Array.<WebInspector.UISourceCode>} uiSourceCodes
+     * @param {WebInspector.UISourceCode} uiSourceCode
      */
-    _uiSourceCodesAdded: function(uiSourceCodes)
+    _fireUISourceCodeAdded: function(uiSourceCode)
     {
-        var data = { removedItems: [], addedItems: uiSourceCodes };
-        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, data);
+        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeAdded, uiSourceCode);
     },
 
     /**
-     * @param {Array.<WebInspector.UISourceCode>} uiSourceCodes
+     * @param {WebInspector.UISourceCode} uiSourceCode
      */
-    _uiSourceCodesRemoved: function(uiSourceCodes)
+    _fireUISourceCodeRemoved: function(uiSourceCode)
     {
-        var data = { removedItems: uiSourceCodes, addedItems: [] };
-        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeListChanged, data);
+        this.dispatchEventToListeners(WebInspector.ScriptMapping.Events.UISourceCodeRemoved, uiSourceCode);
     },
 
     reset: function()

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js (117266 => 117267)


--- trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -124,14 +124,14 @@
     },
 
     /**
-     * @param {Array.<WebInspector.UISourceCode>} oldUISourceCodeList
-     * @param {Array.<WebInspector.UISourceCode>} uiSourceCodeList
+     * @param {WebInspector.UISourceCode} oldUISourceCode
+     * @param {WebInspector.UISourceCode} uiSourceCode
      */
-    replaceUISourceCodes: function(oldUISourceCodeList, uiSourceCodeList)
+    replaceUISourceCode: function(oldUISourceCode, uiSourceCode)
     {
-        this._scriptsView.replaceUISourceCodes(oldUISourceCodeList, uiSourceCodeList);
-        this._contentScriptsView.replaceUISourceCodes(oldUISourceCodeList, uiSourceCodeList);
-        this._snippetsView.replaceUISourceCodes(oldUISourceCodeList, uiSourceCodeList);
+        this._scriptsView.replaceUISourceCode(oldUISourceCode, uiSourceCode);
+        this._contentScriptsView.replaceUISourceCode(oldUISourceCode, uiSourceCode);
+        this._snippetsView.replaceUISourceCode(oldUISourceCode, uiSourceCode);
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (117266 => 117267)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -169,9 +169,9 @@
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._reset.bind(this, false));
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this);
 
-    this._scriptMapping.addEventListener(WebInspector.DebuggerScriptMapping.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this);
-    this._scriptMapping.addEventListener(WebInspector.DebuggerScriptMapping.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
-    this._scriptMapping.addEventListener(WebInspector.DebuggerScriptMapping.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
+    this._scriptMapping.addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this);
+    this._scriptMapping.addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
+    this._scriptMapping.addEventListener(WebInspector.ScriptMapping.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
 
     var enableDebugger = !Capabilities.debuggerCausesRecompilation || WebInspector.settings.debuggerEnabled.get();
     if (enableDebugger)
@@ -494,13 +494,12 @@
      */
     _uiSourceCodeReplaced: function(event)
     {
-        var oldUISourceCodeList = /** @type {Array.<WebInspector.UISourceCode>} */ event.data.oldUISourceCodeList;
-        var uiSourceCodeList = /** @type {Array.<WebInspector.UISourceCode>} */ event.data.uiSourceCodeList;
+        var oldUISourceCode = /** @type {WebInspector.UISourceCode} */ event.data.oldUISourceCode;
+        var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode;
 
-        this._navigator.replaceUISourceCodes(oldUISourceCodeList, uiSourceCodeList);
-        this._editorContainer.replaceFiles(oldUISourceCodeList, uiSourceCodeList);
-        for (var i = 0; i < oldUISourceCodeList.length; ++i)
-            this._removeSourceFrame(oldUISourceCodeList[i]);
+        this._navigator.replaceUISourceCode(oldUISourceCode, uiSourceCode);
+        this._editorContainer.replaceFile(oldUISourceCode, uiSourceCode);
+        this._removeSourceFrame(oldUISourceCode);
     },
 
     _clearCurrentExecutionLine: function()

Modified: trunk/Source/WebCore/inspector/front-end/TabbedEditorContainer.js (117266 => 117267)


--- trunk/Source/WebCore/inspector/front-end/TabbedEditorContainer.js	2012-05-16 12:07:25 UTC (rev 117266)
+++ trunk/Source/WebCore/inspector/front-end/TabbedEditorContainer.js	2012-05-16 12:22:29 UTC (rev 117267)
@@ -266,9 +266,9 @@
 
     /**
      * @param {WebInspector.UISourceCode} oldUISourceCode
-     * @param {WebInspector.UISourceCode} newUISourceCode
+     * @param {WebInspector.UISourceCode} uiSourceCode
      */
-    _replaceFileTab: function(oldUISourceCode, newUISourceCode)
+    replaceFile: function(oldUISourceCode, uiSourceCode)
     {
         var tabId = this._tabIds.get(oldUISourceCode);
         
@@ -277,38 +277,15 @@
         
         delete this._files[this._tabIds.get(oldUISourceCode)]
         this._tabIds.remove(oldUISourceCode);
-        this._tabIds.put(newUISourceCode, tabId);
-        this._files[tabId] = newUISourceCode;
+        this._tabIds.put(uiSourceCode, tabId);
+        this._files[tabId] = uiSourceCode;
 
-        this._tabbedPane.changeTabTitle(tabId, this._titleForFile(newUISourceCode));
-        this._tabbedPane.changeTabView(tabId, this._delegate.viewForFile(newUISourceCode));
-        this._tabbedPane.changeTabTooltip(tabId, this._tooltipForFile(newUISourceCode));
+        this._tabbedPane.changeTabTitle(tabId, this._titleForFile(uiSourceCode));
+        this._tabbedPane.changeTabView(tabId, this._delegate.viewForFile(uiSourceCode));
+        this._tabbedPane.changeTabTooltip(tabId, this._tooltipForFile(uiSourceCode));
     },
 
     /**
-     * @param {Array.<WebInspector.UISourceCode>} oldUISourceCodeList
-     * @param {Array.<WebInspector.UISourceCode>} uiSourceCodeList
-     */
-    replaceFiles: function(oldUISourceCodeList, uiSourceCodeList)
-    {
-        var mainFile;
-        for (var i = 0; i < oldUISourceCodeList.length; ++i) {
-            var tabId = this._tabIds.get(oldUISourceCodeList[i]);
-            if (tabId && (!mainFile || this._tabbedPane.selectedTabId === tabId)) {
-                mainFile = oldUISourceCodeList[i];
-                break;
-            } 
-        }
-        
-        if (!mainFile)
-            return;
-        
-        this._replaceFileTab(mainFile, uiSourceCodeList[0]);
-        for (var i = 0; i < oldUISourceCodeList.length; ++i)
-            this._removeFileTab(oldUISourceCodeList[i]);
-    },
-    
-    /**
      * @param {WebInspector.UISourceCode} uiSourceCode
      * @param {boolean} isDirty
      */
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to