Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js

Issue 2371133003: [Devtools] Lazily build reverse mappings (Closed)
Patch Set: Addressing comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding 7 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding
8 * @param {!WebInspector.NetworkMapping} networkMapping 8 * @param {!WebInspector.NetworkMapping} networkMapping
9 * @implements {WebInspector.TargetManager.Observer} 9 * @implements {WebInspector.TargetManager.Observer}
10 */ 10 */
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 * @return {!Promise<undefined>} 144 * @return {!Promise<undefined>}
145 */ 145 */
146 sourceMapLoaded: function(script, sourceMap) 146 sourceMapLoaded: function(script, sourceMap)
147 { 147 {
148 if (!sourceMap) 148 if (!sourceMap)
149 return Promise.resolve(); 149 return Promise.resolve();
150 var previousScriptState = this._scriptPositions(script); 150 var previousScriptState = this._scriptPositions(script);
151 if (!previousScriptState) 151 if (!previousScriptState)
152 return Promise.resolve(); 152 return Promise.resolve();
153 153
154 var mappings = sourceMap.mappings().slice(); 154 var hasBlackboxedMappings = sourceMap.sourceURLs().some((url) => this.is BlackboxedURL(url));
155 mappings.sort(mappingComparator); 155 var mappings = hasBlackboxedMappings ? sourceMap.mappings().slice() : [] ;
156
157 if (!mappings.length) { 156 if (!mappings.length) {
158 if (previousScriptState.length > 0) 157 if (previousScriptState.length > 0)
159 return this._setScriptState(script, []); 158 return this._setScriptState(script, []);
160 return Promise.resolve(); 159 return Promise.resolve();
161 } 160 }
161 mappings.sort(mappingComparator);
162 162
163 var currentBlackboxed = false; 163 var currentBlackboxed = false;
164 var isBlackboxed = false; 164 var isBlackboxed = false;
165 var positions = []; 165 var positions = [];
166 // If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it. 166 // If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it.
167 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) { 167 if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) {
168 positions.push({ lineNumber: 0, columnNumber: 0}); 168 positions.push({ lineNumber: 0, columnNumber: 0});
169 currentBlackboxed = true; 169 currentBlackboxed = true;
170 } 170 }
171 for (var mapping of mappings) { 171 for (var mapping of mappings) {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 if (scheme === "chrome-extension") 453 if (scheme === "chrome-extension")
454 prefix += parsedURL.host + "\\b"; 454 prefix += parsedURL.host + "\\b";
455 prefix += ".*"; 455 prefix += ".*";
456 } 456 }
457 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b"); 457 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b");
458 } 458 }
459 } 459 }
460 460
461 /** @type {!WebInspector.BlackboxManager} */ 461 /** @type {!WebInspector.BlackboxManager} */
462 WebInspector.blackboxManager; 462 WebInspector.blackboxManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698