Changeset 191612 in webkit
- Timestamp:
- Oct 26, 2015, 4:53:54 PM (10 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r191539 r191612 1 2015-10-26 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Cleanup sidebar panels, reduce `delete` and use Maps instead of objects 4 https://bugs.webkit.org/show_bug.cgi?id=150548 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Views/LayerTreeDetailsSidebarPanel.js: 9 (WebInspector.LayerTreeDetailsSidebarPanel): 10 (WebInspector.LayerTreeDetailsSidebarPanel.prototype._updateDataGrid): 11 (WebInspector.LayerTreeDetailsSidebarPanel.prototype._dataGridNodeForLayer): 12 13 * UserInterface/Views/NavigationSidebarPanel.js: 14 (WebInspector.NavigationSidebarPanel): 15 (WebInspector.NavigationSidebarPanel.restoreStateFromCookie.finalAttemptToRestoreViewStateFromCookie): 16 (WebInspector.NavigationSidebarPanel.restoreStateFromCookie): 17 (WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement): 18 (WebInspector.NavigationSidebarPanel.prototype._updateContentOverflowShadowVisibility): 19 (WebInspector.NavigationSidebarPanel.prototype._checkElementsForPendingViewStateCookie): 20 Switched to using Symbol() to set external properties on tree elements. 21 22 * UserInterface/Views/ScopeChainDetailsSidebarPanel.js: 23 (WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateCallFramesSection): 24 25 * UserInterface/Views/StorageSidebarPanel.js: 26 (WebInspector.StorageSidebarPanel): 27 (WebInspector.StorageSidebarPanel.prototype._addDatabase): 28 (WebInspector.StorageSidebarPanel.prototype._addIndexedDatabase): 29 (WebInspector.StorageSidebarPanel.prototype._addFrameManifest): 30 (WebInspector.StorageSidebarPanel.prototype._storageCleared): 31 1 32 2015-10-24 Nikita Vasilyev <nvasilyev@apple.com> 2 33 -
trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js
r188530 r191612 30 30 super("layer-tree", WebInspector.UIString("Layers"), WebInspector.UIString("Layer")); 31 31 32 this._dataGridNodesByLayerId = {};32 this._dataGridNodesByLayerId = new Map; 33 33 34 34 this.element.classList.add("layer-tree"); … … 259 259 _updateDataGrid(layerForNode, childLayers) 260 260 { 261 var dataGrid = this._dataGrid; 262 263 var mutations = WebInspector.layerTreeManager.layerTreeMutations(this._childLayers, childLayers); 261 let dataGrid = this._dataGrid; 262 let mutations = WebInspector.layerTreeManager.layerTreeMutations(this._childLayers, childLayers); 264 263 265 264 mutations.removals.forEach(function(layer) { 266 var node = this._dataGridNodesByLayerId[layer.layerId];265 let node = this._dataGridNodesByLayerId.get(layer.layerId); 267 266 if (node) { 268 267 dataGrid.removeChild(node); 269 delete this._dataGridNodesByLayerId[layer.layerId];268 this._dataGridNodesByLayerId.delete(layer.layerId); 270 269 } 271 270 }, this); 272 271 273 272 mutations.additions.forEach(function(layer) { 274 varnode = this._dataGridNodeForLayer(layer);273 let node = this._dataGridNodeForLayer(layer); 275 274 if (node) 276 275 dataGrid.appendChild(node); … … 278 277 279 278 mutations.preserved.forEach(function(layer) { 280 var node = this._dataGridNodesByLayerId[layer.layerId];279 let node = this._dataGridNodesByLayerId.get(layer.layerId); 281 280 if (node) 282 281 node.layer = layer; … … 290 289 _dataGridNodeForLayer(layer) 291 290 { 292 var node = new WebInspector.LayerTreeDataGridNode(layer); 293 294 this._dataGridNodesByLayerId[layer.layerId] = node; 291 let node = new WebInspector.LayerTreeDataGridNode(layer); 292 this._dataGridNodesByLayerId.set(layer.layerId, node); 295 293 296 294 return node; -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
r191488 r191612 75 75 WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._checkForStaleResources, this); 76 76 } 77 78 this._pendingViewStateCookie = null; 79 this._restoringState = false; 77 80 } 78 81 … … 240 243 function finalAttemptToRestoreViewStateFromCookie() 241 244 { 242 delete this._finalAttemptToRestoreViewStateTimeout;245 this._finalAttemptToRestoreViewStateTimeout = undefined; 243 246 244 247 this._checkOutlinesForPendingViewStateCookie(true); 245 248 246 delete this._pendingViewStateCookie;247 delete this._restoringState;249 this._pendingViewStateCookie = null; 250 this._restoringState = false; 248 251 } 249 252 … … 330 333 331 334 // If this tree element was expanded during filtering, collapse it again. 332 if (treeElement.expanded && treeElement .__wasExpandedDuringFiltering) {333 delete treeElement.__wasExpandedDuringFiltering;335 if (treeElement.expanded && treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]) { 336 treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol] = false; 334 337 treeElement.collapse(); 335 338 } … … 389 392 390 393 // If this tree element didn't match a built-in filter and was expanded earlier during filtering, collapse it again. 391 if (!flags.expandTreeElement && treeElement.expanded && treeElement .__wasExpandedDuringFiltering) {392 delete treeElement.__wasExpandedDuringFiltering;394 if (!flags.expandTreeElement && treeElement.expanded && treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]) { 395 treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol] = false; 393 396 treeElement.collapse(); 394 397 } … … 465 468 _updateContentOverflowShadowVisibility() 466 469 { 467 delete this._updateContentOverflowShadowVisibilityIdentifier;470 this._updateContentOverflowShadowVisibilityIdentifier = undefined; 468 471 469 472 var scrollHeight = this.contentElement.scrollHeight; … … 699 702 this.showDefaultContentViewForTreeElement(matchedElement); 700 703 701 delete this._pendingViewStateCookie;704 this._pendingViewStateCookie = null; 702 705 703 706 // Delay clearing the restoringState flag until the next runloop so listeners 704 707 // checking for it in this runloop still know state was being restored. 705 708 setTimeout(function() { 706 delete this._restoringState;709 this._restoringState = false; 707 710 }.bind(this)); 708 711 709 712 if (this._finalAttemptToRestoreViewStateTimeout) { 710 713 clearTimeout(this._finalAttemptToRestoreViewStateTimeout); 711 delete this._finalAttemptToRestoreViewStateTimeout;714 this._finalAttemptToRestoreViewStateTimeout = undefined; 712 715 } 713 716 } 714 717 } 715 718 }; 719 720 WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol = Symbol("was-expanded-during-filtering"); 716 721 717 722 WebInspector.NavigationSidebarPanel.OverflowShadowElementStyleClassName = "overflow-shadow"; -
trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js
r188407 r191612 161 161 let foundLocalScope = false; 162 162 163 let sectionCountByType = {};164 for ( vartype in WebInspector.ScopeChainNode.Type)165 sectionCountByType [WebInspector.ScopeChainNode.Type[type]] = 0;163 let sectionCountByType = new Map; 164 for (let type in WebInspector.ScopeChainNode.Type) 165 sectionCountByType.set(WebInspector.ScopeChainNode.Type[type], 0); 166 166 167 167 let scopeChain = callFrame.scopeChain; … … 171 171 let collapsedByDefault = false; 172 172 173 ++sectionCountByType[scope.type]; 173 let count = sectionCountByType.get(scope.type); 174 sectionCountByType.set(scope.type, ++count); 174 175 175 176 switch (scope.type) { … … 210 211 } 211 212 212 let detailsSectionIdentifier = scope.type + "-" + sectionCountByType [scope.type];213 let detailsSectionIdentifier = scope.type + "-" + sectionCountByType.get(scope.type); 213 214 214 215 let scopePropertyPath = WebInspector.PropertyPath.emptyPropertyPathForScope(scope.object); -
trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js
r187872 r191612 66 66 67 67 this._databaseRootTreeElement = null; 68 this._databaseHostTreeElementMap = {};68 this._databaseHostTreeElementMap = new Map; 69 69 70 70 this._indexedDatabaseRootTreeElement = null; 71 this._indexedDatabaseHostTreeElementMap = {};71 this._indexedDatabaseHostTreeElementMap = new Map; 72 72 73 73 this._cookieStorageRootTreeElement = null; 74 74 75 75 this._applicationCacheRootTreeElement = null; 76 this._applicationCacheURLTreeElementMap = {};76 this._applicationCacheURLTreeElementMap = new Map; 77 77 78 78 WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.CookieStorageObjectWasAdded, this._cookieStorageObjectWasAdded, this); … … 212 212 console.assert(database instanceof WebInspector.DatabaseObject); 213 213 214 if (!this._databaseHostTreeElementMap[database.host]) { 215 this._databaseHostTreeElementMap[database.host] = new WebInspector.DatabaseHostTreeElement(database.host); 216 this._databaseRootTreeElement = this._addStorageChild(this._databaseHostTreeElementMap[database.host], this._databaseRootTreeElement, WebInspector.UIString("Databases")); 217 } 218 219 var databaseElement = new WebInspector.DatabaseTreeElement(database); 220 this._databaseHostTreeElementMap[database.host].appendChild(databaseElement); 214 let databaseHostElement = this._databaseHostTreeElementMap.get(database.host); 215 if (!databaseHostElement) { 216 databaseHostElement = new WebInspector.DatabaseHostTreeElement(database.host); 217 this._databaseHostTreeElementMap.set(database.host, databaseHostElement); 218 this._databaseRootTreeElement = this._addStorageChild(treeElement, this._databaseRootTreeElement, WebInspector.UIString("Databases")); 219 } 220 221 let databaseElement = new WebInspector.DatabaseTreeElement(database); 222 databaseHostElement.append(databaseElement); 221 223 } 222 224 … … 237 239 console.assert(indexedDatabase instanceof WebInspector.IndexedDatabase); 238 240 239 if (!this._indexedDatabaseHostTreeElementMap[indexedDatabase.host]) { 240 this._indexedDatabaseHostTreeElementMap[indexedDatabase.host] = new WebInspector.IndexedDatabaseHostTreeElement(indexedDatabase.host); 241 this._indexedDatabaseRootTreeElement = this._addStorageChild(this._indexedDatabaseHostTreeElementMap[indexedDatabase.host], this._indexedDatabaseRootTreeElement, WebInspector.UIString("Indexed Databases")); 242 } 243 244 var indexedDatabaseElement = new WebInspector.IndexedDatabaseTreeElement(indexedDatabase); 245 this._indexedDatabaseHostTreeElementMap[indexedDatabase.host].appendChild(indexedDatabaseElement); 241 let indexedDatabaseHostElement = this._indexedDatabaseHostTreeElementMap.get(indexedDatabase.host); 242 if (!indexedDatabaseHostElement) { 243 indexedDatabaseHostElement = new WebInspector.IndexedDatabaseHostTreeElement(indexedDatabase.host); 244 this._indexedDatabaseHostTreeElementMap.set(indexedDatabase.host, indexedDatabaseHostElement); 245 this._indexedDatabaseRootTreeElement = this._addStorageChild(indexedDatabaseHostElement, this._indexedDatabaseRootTreeElement, WebInspector.UIString("Indexed Databases")); 246 } 247 248 let indexedDatabaseElement = new WebInspector.IndexedDatabaseTreeElement(indexedDatabase); 249 indexedDatabaseHostElement.append(indexedDatabaseElement); 246 250 } 247 251 … … 268 272 console.assert(frameManifest instanceof WebInspector.ApplicationCacheFrame); 269 273 270 var manifest = frameManifest.manifest; 271 var manifestURL = manifest.manifestURL; 272 if (!this._applicationCacheURLTreeElementMap[manifestURL]) { 273 this._applicationCacheURLTreeElementMap[manifestURL] = new WebInspector.ApplicationCacheManifestTreeElement(manifest); 274 this._applicationCacheRootTreeElement = this._addStorageChild(this._applicationCacheURLTreeElementMap[manifestURL], this._applicationCacheRootTreeElement, WebInspector.UIString("Application Cache")); 275 } 276 277 var frameCacheElement = new WebInspector.ApplicationCacheFrameTreeElement(frameManifest); 278 this._applicationCacheURLTreeElementMap[manifestURL].appendChild(frameCacheElement); 274 let manifest = frameManifest.manifest; 275 let manifestURL = manifest.manifestURL; 276 let applicationCacheManifestElement = this._applicationCacheURLTreeElementMap.get(manifestURL); 277 if (!applicationCacheManifestElement) { 278 applicationCacheManifestElement = new WebInspector.ApplicationCacheManifestTreeElement(manifest); 279 this._applicationCacheURLTreeElementMap.set(manifestURL, applicationCacheManifestElement); 280 this._applicationCacheRootTreeElement = this._addStorageChild(applicationCacheManifestElement, this._applicationCacheRootTreeElement, WebInspector.UIString("Application Cache")); 281 } 282 283 let frameCacheElement = new WebInspector.ApplicationCacheFrameTreeElement(frameManifest); 284 applicationCacheManifestElement.append(frameCacheElement); 279 285 } 280 286 … … 354 360 this._sessionStorageRootTreeElement = null; 355 361 this._databaseRootTreeElement = null; 356 this._databaseHostTreeElementMap = {};362 this._databaseHostTreeElementMap.clear(); 357 363 this._indexedDatabaseRootTreeElement = null; 358 this._indexedDatabaseHostTreeElementMap = {};364 this._indexedDatabaseHostTreeElementMap.clear(); 359 365 this._cookieStorageRootTreeElement = null; 360 366 this._applicationCacheRootTreeElement = null; 361 this._applicationCacheURLTreeElementMap = {};367 this._applicationCacheURLTreeElementMap.clear(); 362 368 } 363 369
Note:
See TracChangeset
for help on using the changeset viewer.