Title: [158881] trunk/Source/WebInspectorUI
Revision
158881
Author
[email protected]
Date
2013-11-07 15:34:47 -0800 (Thu, 07 Nov 2013)

Log Message

Web Inspector: CSS Regions: Use a Map object to store the ContentFlows
https://bugs.webkit.org/show_bug.cgi?id=124015

Reviewed by Joseph Pecoraro.

Changed the Object hashmap to a Map based hashmap when storing the flows in DOMTreeManager.

* UserInterface/DOMTreeManager.js:
(WebInspector.DOMTreeManager):
(WebInspector.DOMTreeManager.prototype.getNamedFlowCollection):
(WebInspector.DOMTreeManager.prototype.namedFlowRemoved):
(WebInspector.DOMTreeManager.prototype._sendNamedFlowUpdateEvents):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (158880 => 158881)


--- trunk/Source/WebInspectorUI/ChangeLog	2013-11-07 23:31:08 UTC (rev 158880)
+++ trunk/Source/WebInspectorUI/ChangeLog	2013-11-07 23:34:47 UTC (rev 158881)
@@ -1,3 +1,18 @@
+2013-11-07  Alexandru Chiculita  <[email protected]>
+
+        Web Inspector: CSS Regions: Use a Map object to store the ContentFlows
+        https://bugs.webkit.org/show_bug.cgi?id=124015
+
+        Reviewed by Joseph Pecoraro.
+
+        Changed the Object hashmap to a Map based hashmap when storing the flows in DOMTreeManager.
+
+        * UserInterface/DOMTreeManager.js:
+        (WebInspector.DOMTreeManager):
+        (WebInspector.DOMTreeManager.prototype.getNamedFlowCollection):
+        (WebInspector.DOMTreeManager.prototype.namedFlowRemoved):
+        (WebInspector.DOMTreeManager.prototype._sendNamedFlowUpdateEvents):
+
 2013-11-07  Timothy Hatcher  <[email protected]>
 
         Fix up some sidebar switching details to make selections persist better.

Modified: trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js (158880 => 158881)


--- trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js	2013-11-07 23:31:08 UTC (rev 158880)
+++ trunk/Source/WebInspectorUI/UserInterface/DOMTreeManager.js	2013-11-07 23:34:47 UTC (rev 158881)
@@ -39,7 +39,7 @@
     this._idToDOMNode = {};
     this._document = null;
     this._attributeLoadNodeIds = {};
-    this._flows = {};
+    this._flows = new Map;
     this._contentNodesToFlowsMap = new Map;
 }
 
@@ -572,12 +572,12 @@
             for (var i = 0; i < flows.length; ++i) {
                 var flowPayload = flows[i];
                 var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);
-                var contentFlow = this._flows[flowKey];
+                var contentFlow = this._flows.get(flowKey);
                 if (contentFlow)
                     this._updateContentFlowFromPayload(contentFlow, flowPayload);
                 else {
                     contentFlow = this._createContentFlowFromPayload(flowPayload);
-                    this._flows[flowKey] = contentFlow;
+                    this._flows.set(flowKey, contentFlow);
                 }
                 contentFlows.push(contentFlow);
             }
@@ -589,26 +589,26 @@
     namedFlowCreated: function(flowPayload)
     {
         var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);
-        console.assert(!this._flows.hasOwnProperty(flowKey));
+        console.assert(!this._flows.has(flowKey));
         var contentFlow = this._createContentFlowFromPayload(flowPayload);
-        this._flows[flowKey] = contentFlow;
+        this._flows.set(flowKey, contentFlow);
         this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasAdded, {flow: contentFlow});
     },
 
     namedFlowRemoved: function(documentNodeIdentifier, flowName)
     {
         var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId: documentNodeIdentifier, name: flowName});
-        var contentFlow = this._flows[flowKey];
+        var contentFlow = this._flows.get(flowKey);
         console.assert(contentFlow);
-        delete this._flows[flowKey];
+        this._flows.delete(flowKey);
         this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, {flow: contentFlow});
     },
 
     _sendNamedFlowUpdateEvents: function(flowPayload)
     {
         var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);
-        console.assert(this._flows.hasOwnProperty(flowKey));
-        this._updateContentFlowFromPayload(this._flows[flowKey], flowPayload);
+        console.assert(this._flows.has(flowKey));
+        this._updateContentFlowFromPayload(this._flows.get(flowKey), flowPayload);
     },
 
     regionLayoutUpdated: function(flowPayload)
@@ -624,10 +624,10 @@
     registeredNamedFlowContentElement: function(documentNodeIdentifier, flowName, contentNodeId, nextContentElementNodeId)
     {
         var flowKey = WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId: documentNodeIdentifier, name: flowName});
-        console.assert(this._flows.hasOwnProperty(flowKey));
+        console.assert(this._flows.has(flowKey));
         console.assert(!this._contentNodesToFlowsMap.has(contentNodeId));
 
-        var flow = this._flows[flowKey];
+        var flow = this._flows.get(flowKey);
         var contentNode = this.nodeForId(contentNodeId);
 
         this._contentNodesToFlowsMap.set(contentNode.id, flow);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to