Title: [104676] branches/chromium/963/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
- Revision
- 104676
- Author
- [email protected]
- Date
- 2012-01-10 23:53:21 -0800 (Tue, 10 Jan 2012)
Log Message
Merge 104563 - Web Inspector: fix DebuggerPresentationModel::uiSourceCodes - do not iterate
over same raw source code multiple times.
https://bugs.webkit.org/show_bug.cgi?id=75953
Reviewed by Yury Semikhatsky.
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel):
(WebInspector.DebuggerPresentationModel.prototype._bindScriptToRawSourceCode):
(WebInspector.DebuggerPresentationModel.prototype.uiSourceCodes):
(WebInspector.DebuggerPresentationModel.prototype.setFormatSource):
(WebInspector.DebuggerPresentationModel.prototype._consoleCleared):
(WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
[email protected]
BUG=109730
Review URL: http://codereview.chromium.org/9187001
Modified Paths
Diff
Modified: branches/chromium/963/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (104675 => 104676)
--- branches/chromium/963/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2012-01-11 07:14:38 UTC (rev 104675)
+++ branches/chromium/963/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2012-01-11 07:53:21 UTC (rev 104676)
@@ -36,6 +36,7 @@
{
// FIXME: apply formatter from outside as a generic mapping.
this._formatter = new WebInspector.ScriptFormatter();
+ this._rawSourceCodes = [];
this._rawSourceCodeForScriptId = {};
this._rawSourceCodeForURL = {};
this._rawSourceCodeForDocumentURL = {};
@@ -140,6 +141,7 @@
}
rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, this._formatter, this._formatSource);
+ this._rawSourceCodes.push(rawSourceCode);
this._bindScriptToRawSourceCode(script, rawSourceCode);
if (isInlineScript)
@@ -176,10 +178,10 @@
uiSourceCodes: function()
{
var result = [];
- for (var id in this._rawSourceCodeForScriptId) {
- var uiSourceCodeList = this._rawSourceCodeForScriptId[id].sourceMapping.uiSourceCodeList();
- for (var i = 0; i < uiSourceCodeList.length; ++i)
- result.push(uiSourceCodeList[i]);
+ for (var i = 0; i < this._rawSourceCodes.length; ++i) {
+ var uiSourceCodeList = this._rawSourceCodes[i].sourceMapping.uiSourceCodeList();
+ for (var j = 0; j < uiSourceCodeList.length; ++j)
+ result.push(uiSourceCodeList[j]);
}
return result;
},
@@ -331,8 +333,8 @@
this._formatSource = formatSource;
this._breakpointManager.reset();
- for (var id in this._rawSourceCodeForScriptId)
- this._rawSourceCodeForScriptId[id].setFormatted(this._formatSource);
+ for (var i = 0; i < this._rawSourceCodes.length; ++i)
+ this._rawSourceCodes[i].setFormatted(this._formatSource);
},
/**
@@ -382,8 +384,8 @@
_consoleCleared: function()
{
- for (var id in this._rawSourceCodeForScriptId)
- this._rawSourceCodeForScriptId[id].messages = [];
+ for (var i = 0; i < this._rawSourceCodes.length; ++i)
+ this._rawSourceCodes[i].messages = [];
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessagesCleared);
},
@@ -654,15 +656,16 @@
_debuggerReset: function()
{
- for (var id in this._rawSourceCodeForScriptId) {
- var rawSourceCode = this._rawSourceCodeForScriptId[id];
+ for (var i = 0; i < this._rawSourceCodes.length; ++i) {
+ var rawSourceCode = this._rawSourceCodes[i];
if (rawSourceCode.sourceMapping) {
var uiSourceCodeList = rawSourceCode.sourceMapping.uiSourceCodeList();
- for (var i = 0; i < uiSourceCodeList.length; ++i)
- this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, uiSourceCodeList[i]);
+ for (var j = 0; j < uiSourceCodeList.length; ++j)
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, uiSourceCodeList[j]);
}
rawSourceCode.removeAllListeners();
}
+ this._rawSourceCodes = [];
this._rawSourceCodeForScriptId = {};
this._rawSourceCodeForURL = {};
this._rawSourceCodeForDocumentURL = {};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes