Changeset 116077 in webkit
- Timestamp:
- May 4, 2012 2:10:09 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r116076 r116077 1 2012-05-03 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: createRawLocationByURL is too slow if a big number of evals happen. 4 https://bugs.webkit.org/show_bug.cgi?id=85477 5 6 It iterates through all the _scripts even they have no url. 7 We can keep a separate map of scripts with url. 8 9 Reviewed by Yury Semikhatsky. 10 11 * http/tests/inspector/compiler-script-mapping.html: 12 * http/tests/inspector/debugger-test.js: 13 (initialize_DebuggerTest): 14 * inspector/debugger/raw-source-code.html: 15 1 16 2012-05-04 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> 2 17 -
trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html
r114241 r116077 125 125 function testCompilerScriptMapping(next) 126 126 { 127 WebInspector.debuggerModel._ scripts = [];127 WebInspector.debuggerModel._reset(); 128 128 var mapping = new WebInspector.CompilerScriptMapping(); 129 129 var script = InspectorTest.createScriptMock("compiled.js", 0, 0, true, ""); … … 161 161 function testInlinedSourceMap(next) 162 162 { 163 WebInspector.debuggerModel._ scripts = [];163 WebInspector.debuggerModel._reset(); 164 164 var mapping = new WebInspector.CompilerScriptMapping(); 165 165 var script = InspectorTest.createScriptMock("http://example.com/compiled.js", 0, 0, true, ""); … … 192 192 { 193 193 WebInspector.settings.sourceMapsEnabled.set(true); 194 WebInspector.debuggerModel._ scripts = [];194 WebInspector.debuggerModel._reset(); 195 195 var mainScriptMapping = new WebInspector.MainScriptMapping(); 196 196 mainScriptMapping.addEventListener(WebInspector.MainScriptMapping.Events.UISourceCodeListChanged, uiSourceCodeListChanged); -
trunk/LayoutTests/http/tests/inspector/debugger-test.js
r115979 r116077 292 292 var script = new WebInspector.Script(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript); 293 293 script.requestContent = function(callback) { callback(source); }; 294 WebInspector.debuggerModel._ scripts[scriptId] = script;294 WebInspector.debuggerModel._registerScript(script); 295 295 return script; 296 296 } -
trunk/LayoutTests/inspector/debugger/raw-source-code.html
r115979 r116077 93 93 function testScriptWithoutResource(next) 94 94 { 95 WebInspector.debuggerModel._ scripts = [];95 WebInspector.debuggerModel._reset(); 96 96 var script = InspectorTest.createScriptMock("foo.js", 0, 0, true, "<script source>"); 97 97 var rawSourceCode = createRawSourceCode(script, null); … … 114 114 function testHTMLWithPendingResource(next) 115 115 { 116 WebInspector.debuggerModel._ scripts = [];116 WebInspector.debuggerModel._reset(); 117 117 var script1 = InspectorTest.createScriptMock("index.html", 0, 10, false, "<script source 1>"); 118 118 var script2 = InspectorTest.createScriptMock("index.html", 0, 45, false, "<script source 2>"); … … 148 148 function testHTMLWithFinishedResource(next) 149 149 { 150 WebInspector.debuggerModel._ scripts = [];150 WebInspector.debuggerModel._reset(); 151 151 var script1 = InspectorTest.createScriptMock("index.html", 1, 10, false, "<script source 1>"); 152 152 var script2 = InspectorTest.createScriptMock("index.html", 5, 45, false, "<script\nsource\n2>"); … … 177 177 function testForceUpdateSourceMapping(next) 178 178 { 179 WebInspector.debuggerModel._ scripts = [];179 WebInspector.debuggerModel._reset(); 180 180 var script1 = InspectorTest.createScriptMock("index.html", 0, 10, false, "<script source 1>"); 181 181 var script2 = InspectorTest.createScriptMock("index.html", 0, 45, false, "<script source 2>"); … … 244 244 function testFormattingWithFinishedResource(next) 245 245 { 246 WebInspector.debuggerModel._ scripts = [];246 WebInspector.debuggerModel._reset(); 247 247 var script = InspectorTest.createScriptMock("foo.js", 0, 0, true, "<script source>"); 248 248 var request = createFinishedRequestMock("script", "<resource content>"); … … 303 303 function testFormattingWithPendingResource(next) 304 304 { 305 WebInspector.debuggerModel._ scripts = [];305 WebInspector.debuggerModel._reset(); 306 306 var script = InspectorTest.createScriptMock("foo.js", 0, 0, true, "<script source>"); 307 307 var request = createPendingRequestMock("script", "<resource content>"); -
trunk/Source/WebCore/ChangeLog
r116069 r116077 1 2012-05-03 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: createRawLocationByURL is too slow if a big number of evals happen. 4 https://bugs.webkit.org/show_bug.cgi?id=85477 5 6 It iterates through all the _scripts even they have no url. 7 We can keep a separate map of scripts with url. 8 9 Reviewed by Yury Semikhatsky. 10 11 * inspector/front-end/DebuggerModel.js: 12 (WebInspector.DebuggerModel): 13 (WebInspector.DebuggerModel.prototype._globalObjectCleared): 14 (WebInspector.DebuggerModel.prototype._resetScriptsMap): 15 (WebInspector.DebuggerModel.prototype._parsedScriptSource): 16 (WebInspector.DebuggerModel.prototype.createRawLocationByURL): 17 1 18 2012-05-03 David Barr <davidbarr@chromium.org> 2 19 -
trunk/Source/WebCore/inspector/front-end/DebuggerModel.js
r115984 r116077 40 40 */ 41 41 this._scripts = {}; 42 this._scriptsBySourceURL = {}; 42 43 43 44 this._canSetScriptSource = false; … … 150 151 // Adjust column if needed. 151 152 var minColumnNumber = 0; 152 for (var id in this._scripts) { 153 var script = this._scripts[id]; 154 if (url === script.sourceURL && lineNumber === script.lineOffset) 153 var scripts = this._scriptsBySourceURL[url] || []; 154 for (var i = 0, l = scripts.length; i < l; ++i) { 155 var script = scripts[i]; 156 if (lineNumber === script.lineOffset) 155 157 minColumnNumber = minColumnNumber ? Math.min(minColumnNumber, script.columnOffset) : script.columnOffset; 156 158 } … … 215 217 { 216 218 this._setDebuggerPausedDetails(null); 219 this._reset(); 220 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalObjectCleared); 221 }, 222 223 _reset: function() 224 { 217 225 this._scripts = {}; 218 this. dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalObjectCleared);226 this._scriptsBySourceURL = {}; 219 227 }, 220 228 … … 323 331 { 324 332 var script = new WebInspector.Script(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL); 325 this._ scripts[scriptId] = script;333 this._registerScript(script); 326 334 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource, script); 335 }, 336 337 /** 338 * @param {WebInspector.Script} script 339 */ 340 _registerScript: function(script) 341 { 342 this._scripts[script.scriptId] = script; 343 if (script.sourceURL) { 344 var scripts = this._scriptsBySourceURL[script.sourceURL]; 345 if (!scripts) { 346 scripts = []; 347 this._scriptsBySourceURL[script.sourceURL] = scripts; 348 } 349 scripts.push(script); 350 } 327 351 }, 328 352 … … 362 386 { 363 387 var closestScript = null; 364 for (var scriptId in this._scripts) { 365 var script = this._scripts[scriptId]; 366 if (script.sourceURL !== sourceURL) 367 continue; 388 var scripts = this._scriptsBySourceURL[sourceURL] || []; 389 for (var i = 0, l = scripts.length; i < l; ++i) { 390 var script = scripts[i]; 368 391 if (!closestScript) 369 392 closestScript = script;
Note: See TracChangeset
for help on using the changeset viewer.