Summary: | Web Inspector: Cleanup DebuggerManager, reduce `delete` and use Maps instead of objects | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Matt Baker <mattbaker> | ||||||
Component: | Web Inspector | Assignee: | Matt Baker <mattbaker> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | bburg, commit-queue, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Attachments: |
|
Description
Matt Baker
2015-10-02 12:44:58 PDT
Created attachment 262371 [details]
[Patch] Proposed Fix
No instances of delete to remove (other than those used to remove hashmap object properties), just the switch to using Map. Comment on attachment 262371 [details] [Patch] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=262371&action=review r=me > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:280 > + if (this._breakpointURLMap.has(sourceCode.url)) { > + let urlBreakpoints = this._breakpointURLMap.get(sourceCode.url); I tend to think we should reduce "has" && "get" to just a get. let urlBreakpoints = this._breakpointURLMap.get(sourceCode.url); if (urlBreakpoints) { ... } > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:286 > + if (sourceCode instanceof WebInspector.Script && this._breakpointScriptIdentifierMap.has(sourceCode.id)) { > + let scriptIdentifierBreakpoints = this._breakpointScriptIdentifierMap.get(sourceCode.id); Same here, but it would involve more rewriting. > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:296 > - return this._breakpointIdMap[id]; > + return this._breakpointIdMap.get(id); We probably should do `|| null` here too. > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:301 > + return this._scriptIdMap.get(id); This should still have `|| null` to return `null` for missing values instead of `undefined`. Created attachment 262374 [details]
[Patch] For Landing
Comment on attachment 262374 [details] [Patch] For Landing Clearing flags on attachment: 262374 Committed r190540: <http://trac.webkit.org/changeset/190540> All reviewed patches have been landed. Closing bug. |