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

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

Issue 2371133003: [Devtools] Lazily build reverse mappings (Closed)
Patch Set: Make all parsing lazy. 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 hasBlackboxedMappings = false;
lushnikov 2016/09/28 16:48:12 what's this code about?
eostroukhov 2016/09/28 23:26:33 There is no reason to check individual mappings if
lushnikov 2016/09/29 16:29:52 Nice, thanks
155 for (var scriptURL of sourceMap.sourceURLs()) {
156 if (this.isBlackboxedURL(scriptURL)) {
157 hasBlackboxedMappings = true;
158 break;
159 }
160 }
161 if (!hasBlackboxedMappings) {
162 if (previousScriptState.length > 0)
163 return this._setScriptState(script, []);
164 return Promise.resolve();
165 }
166
154 var mappings = sourceMap.mappings().slice(); 167 var mappings = sourceMap.mappings().slice();
155 mappings.sort(mappingComparator); 168 mappings.sort(mappingComparator);
156 169
157 if (!mappings.length) { 170 if (!mappings.length) {
158 if (previousScriptState.length > 0) 171 if (previousScriptState.length > 0)
159 return this._setScriptState(script, []); 172 return this._setScriptState(script, []);
160 return Promise.resolve(); 173 return Promise.resolve();
161 } 174 }
162 175
163 var currentBlackboxed = false; 176 var currentBlackboxed = false;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 if (scheme === "chrome-extension") 466 if (scheme === "chrome-extension")
454 prefix += parsedURL.host + "\\b"; 467 prefix += parsedURL.host + "\\b";
455 prefix += ".*"; 468 prefix += ".*";
456 } 469 }
457 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b"); 470 return prefix + name.escapeForRegExp() + (url.endsWith(name) ? "$" : "\\ b");
458 } 471 }
459 } 472 }
460 473
461 /** @type {!WebInspector.BlackboxManager} */ 474 /** @type {!WebInspector.BlackboxManager} */
462 WebInspector.blackboxManager; 475 WebInspector.blackboxManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698