Chromium Code Reviews
DescriptionDevTools: kill DebuggerWorkspaceBinding.{push,pop,set}SourceMapping
Today, there are three methods to manage mapping between scripts and uiSourceCodes:
- pushSourceMapping: adds a raw to ui mapping for the scripts
- popSourceMapping: removes a raw to ui mapping from the script
- setSourceMapping: establishes a ui to raw mapping from uiSourceCode to script
These methods have a few disadvantages:
- adding mapping per-script is a memory-consuming approach, given how many scripts DevTools
occasionally has
- the push/pop API is invalid and does not allow to remove mapping. For this reason, the
popSourceMapping is almost never used.
- existence of a separate setSourceMapping method to setup a backward mapping means
that there's no guarantee that:
rawLocation == ui2raw(raw2ui(rawLocation))
This patch kills the {push,pop,set}SourceMapping methods in favor of a simplistic approach, already
implemented in CSSWorkspaceBindings:
1. external mappings (Such as snippets and SourceFormatter) are registered via the
DebuggerWorkspaceBidning.addSourceMapping method
2. the raw to ui mapping is:
- querying external mappings first
- queries CompilerScriptMapping (sourceMaps)
- queries ResourceScriptMapping (regular mapping)
- queries DefaultScriptMapping (VM UISourceCodes)
3. the ui to raw mapping queries mappings in the same order as raw to ui.
Additionally, with the new persistence, mappings are never actually change: there's
*ALWAYS ONLY ONE* mapping which controls both lifetime and mapping of each UISourceCode.
This means that the DebuggerWorkspace.SourceMappingChanged event is not needed.
To sum up, this patch:
- kills push/pop/set methods in favor of a simplistic approach, already implemented in
CSSWorkspaceBinding.
- gets rid of DebuggerWorkspaceBinding.SourceMappingChanged event. It's not needed since mappings
never actually change
- cleans up the DebuggerSourceMapping interface: there's no more need for the isIdentity and
uiLineHasMapping methods.
R=dgozman
BUG=670180
Review-Url: https://codereview.chromium.org/2931773002
Cr-Commit-Position: refs/heads/master@{#478142}
Committed: https://chromium.googlesource.com/chromium/src/+/96693ab93867d6a24f3262d9cbb0df5cf102202b
Patch Set 1 #
Total comments: 14
Patch Set 2 : address comments #
Total comments: 2
Patch Set 3 : address comments #Dependent Patchsets: Messages
Total messages: 21 (14 generated)
|