Changeset 96500 in webkit
- Timestamp:
- Oct 3, 2011 8:07:00 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r96499 r96500 1 2011-10-03 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: debuggerPresentatioModel.linkifyLocation leaks updateAnchor closure instances. 4 https://bugs.webkit.org/show_bug.cgi?id=69146 5 6 In many places we use linkifyLocation function to produce a link node which updates automatically when the source file is changed on the fly. 7 Such changes happen when we use pretty print or another operation that changes the source code somehow. 8 linkifyLocation associates a new instance of updateAnchor closure with the each link node and add the closure to the SourceMappingUpdated event's list. 9 As the result the node<->closure pairs wouldn't be collected until reset the UI and DebuggerPresentationModel. 10 11 Reviewed by Yury Semikhatsky. 12 13 Test: inspector/performance/resources/network-append-30-requests.html 14 15 * WebCore.gypi: 16 * WebCore.vcproj/WebCore.vcproj: 17 * inspector/front-end/ConsoleMessage.js: 18 (WebInspector.ConsoleMessage.prototype._linkifyLocation): 19 * inspector/front-end/ConsoleView.js: 20 (WebInspector.ConsoleView.prototype._consoleCleared): 21 * inspector/front-end/DebuggerPresentationModel.js: 22 * inspector/front-end/EventListenersSidebarPane.js: 23 (WebInspector.EventListenersSidebarPane.prototype.update.callback): 24 (WebInspector.EventListenersSidebarPane.prototype.update): 25 (): 26 * inspector/front-end/Linkifier.js: Added. 27 (WebInspector.Linkifier): 28 (WebInspector.Linkifier.prototype.linkifyLocation): 29 (WebInspector.Linkifier.prototype.reset): 30 (WebInspector.Linkifier.prototype._updateSourceAnchors): 31 (WebInspector.Linkifier.prototype._updateAnchor): 32 * inspector/front-end/NetworkPanel.js: 33 (WebInspector.NetworkLogView): 34 (WebInspector.NetworkLogView.prototype._reset): 35 (WebInspector.NetworkDataGridNode.prototype._refreshInitiatorCell): 36 * inspector/front-end/ProfileDataGridTree.js: 37 (WebInspector.ProfileDataGridNode.prototype.createCell): 38 * inspector/front-end/ProfileView.js: 39 (WebInspector.CPUProfileView): 40 (WebInspector.CPUProfileView.prototype._resetClicked): 41 * inspector/front-end/TimelinePanel.js: 42 (WebInspector.TimelinePanel): 43 (WebInspector.TimelinePanel.prototype._linkifyLocation): 44 (WebInspector.TimelinePanel.prototype._linkifyCallFrame): 45 (WebInspector.TimelinePanel.prototype._clearPanel): 46 (WebInspector.TimelinePanel.FormattedRecord): 47 (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent): 48 (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails): 49 (WebInspector.TimelinePanel.PopupContentHelper): 50 (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendLinkRow): 51 (WebInspector.TimelinePanel.PopupContentHelper.prototype._appendStackTrace): 52 * inspector/front-end/WebKit.qrc: 53 * inspector/front-end/inspector.html: 54 * inspector/front-end/inspector.js: 55 1 56 2011-10-03 Pavel Feldman <pfeldman@google.com> 2 57 -
trunk/Source/WebCore/WebCore.gypi
r96398 r96500 6235 6235 'inspector/front-end/DebuggerModel.js', 6236 6236 'inspector/front-end/DebuggerPresentationModel.js', 6237 'inspector/front-end/Linkifier.js', 6237 6238 'inspector/front-end/DetailedHeapshotGridNodes.js', 6238 6239 'inspector/front-end/DetailedHeapshotView.js', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r96313 r96500 69350 69350 </File> 69351 69351 <File 69352 RelativePath="..\inspector\front-end\Linkifier.js" 69353 > 69354 </File> 69355 <File 69352 69356 RelativePath="..\inspector\front-end\MetricsSidebarPane.js" 69353 69357 > -
trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js
r96499 r96500 195 195 lineNumber = lineNumber ? lineNumber - 1 : undefined; 196 196 columnNumber = columnNumber ? columnNumber - 1 : 0; 197 return WebInspector. debuggerPresentationModel.linkifyLocation(url, lineNumber, columnNumber, "console-message-url");197 return WebInspector.ConsoleView.linkifier.linkifyLocation(url, lineNumber, columnNumber, "console-message-url"); 198 198 }, 199 199 -
trunk/Source/WebCore/inspector/front-end/ConsoleView.js
r96499 r96500 110 110 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._consoleMessageAdded, this); 111 111 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._consoleCleared, this); 112 113 WebInspector.ConsoleView.linkifier = new WebInspector.Linkifier(WebInspector.debuggerPresentationModel); 112 114 } 113 115 … … 329 331 330 332 this.dispatchEventToListeners(WebInspector.ConsoleView.Events.ConsoleCleared); 333 334 WebInspector.ConsoleView.linkifier.reset(); 331 335 }, 332 336 -
trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
r96097 r96500 67 67 68 68 WebInspector.DebuggerPresentationModel.prototype = { 69 linkifyLocation: function(sourceURL, lineNumber, columnNumber, classes)70 {71 var linkText = WebInspector.formatLinkText(sourceURL, lineNumber);72 var anchor = WebInspector.linkifyURLAsNode(sourceURL, linkText, classes, false);73 74 var rawSourceCode = this._rawSourceCodeForScript(sourceURL);75 if (!rawSourceCode) {76 anchor.setAttribute("preferred_panel", "resources");77 anchor.setAttribute("line_number", lineNumber);78 return anchor;79 }80 81 function updateAnchor()82 {83 var uiLocation = rawSourceCode.sourceMapping.rawLocationToUILocation({ lineNumber: lineNumber, columnNumber: columnNumber });84 anchor.textContent = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber);85 anchor.setAttribute("preferred_panel", "scripts");86 anchor.uiSourceCode = uiLocation.uiSourceCode;87 anchor.lineNumber = uiLocation.lineNumber;88 }89 if (rawSourceCode.sourceMapping)90 updateAnchor.call(this);91 rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, updateAnchor, this);92 return anchor;93 },94 95 69 _parsedScriptSource: function(event) 96 70 { -
trunk/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js
r94754 r96500 57 57 58 58 this.titleElement.appendChild(this.settingsSelectElement); 59 60 this._linkifier = new WebInspector.Linkifier(WebInspector.debuggerPresentationModel); 59 61 } 60 62 … … 65 67 { 66 68 RuntimeAgent.releaseObjectGroup(WebInspector.EventListenersSidebarPane._objectGroupName); 69 this._linkifier.reset(); 70 67 71 var body = this.bodyElement; 68 72 body.removeChildren(); … … 85 89 var section = sectionMap[type]; 86 90 if (!section) { 87 section = new WebInspector.EventListenersSection(type, node.id );91 section = new WebInspector.EventListenersSection(type, node.id, self._linkifier); 88 92 sectionMap[type] = section; 89 93 sectionNames.push(type); … … 125 129 WebInspector.EventListenersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; 126 130 127 WebInspector.EventListenersSection = function(title, nodeId )131 WebInspector.EventListenersSection = function(title, nodeId, linkifier) 128 132 { 129 133 this.eventListeners = []; 130 134 this._nodeId = nodeId; 135 this._linkifier = linkifier; 131 136 WebInspector.PropertiesSection.call(this, title); 132 137 … … 159 164 for (var i = 0; i < length; ++i) { 160 165 var eventListener = filteredEventListeners[i]; 161 var eventListenerBar = new WebInspector.EventListenerBar(eventListener, this._nodeId );166 var eventListenerBar = new WebInspector.EventListenerBar(eventListener, this._nodeId, this._linkifier); 162 167 this.eventBars.appendChild(eventListenerBar.element); 163 168 } … … 172 177 WebInspector.EventListenersSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; 173 178 174 WebInspector.EventListenerBar = function(eventListener, nodeId )179 WebInspector.EventListenerBar = function(eventListener, nodeId, linkifier) 175 180 { 176 181 this.eventListener = eventListener; … … 178 183 WebInspector.ObjectPropertiesSection.call(this); 179 184 this._setNodeTitle(); 180 this._setFunctionSubtitle( );185 this._setFunctionSubtitle(linkifier); 181 186 this.editable = false; 182 187 this.element.className = "event-bar"; /* Changed from "section" */ … … 232 237 }, 233 238 234 _setFunctionSubtitle: function( )239 _setFunctionSubtitle: function(linkifier) 235 240 { 236 241 // Requires that Function.toString() return at least the function's signature. … … 241 246 var lineNumber = this.eventListener.location.lineNumber - 1; 242 247 var columnNumber = 0; 243 var urlElement = WebInspector.debuggerPresentationModel.linkifyLocation(url, lineNumber, columnNumber);248 var urlElement = linkifier.linkifyLocation(url, lineNumber, columnNumber); 244 249 this.subtitleElement.appendChild(urlElement); 245 250 } else { -
trunk/Source/WebCore/inspector/front-end/NetworkPanel.js
r96326 r96500 57 57 this._createStatusbarButtons(); 58 58 this._createFilterStatusBarItems(); 59 this._linkifier = new WebInspector.Linkifier(WebInspector.debuggerPresentationModel); 59 60 60 61 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this); … … 736 737 this._mainResourceLoadTime = -1; 737 738 this._mainResourceDOMContentTime = -1; 738 739 this._linkifier.reset(); 739 740 }, 740 741 … … 2042 2043 } 2043 2044 this._initiatorCell.title = topFrame.url + ":" + topFrame.lineNumber; 2044 var urlElement = WebInspector.debuggerPresentationModel.linkifyLocation(topFrame.url, topFrame.lineNumber - 1, 0);2045 var urlElement = this._parentView._linkifier.linkifyLocation(topFrame.url, topFrame.lineNumber - 1, 0); 2045 2046 this._initiatorCell.appendChild(urlElement); 2046 2047 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Script")); -
trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js
r95027 r96500 99 99 // FIXME(62725): profileNode should reference a debugger location. 100 100 var lineNumber = this.profileNode.lineNumber ? this.profileNode.lineNumber - 1 : 0; 101 var urlElement = WebInspector.debuggerPresentationModel.linkifyLocation(this.profileNode.url, lineNumber, 0, "profile-node-file");101 var urlElement = this.profileView._linkifier.linkifyLocation(this.profileNode.url, lineNumber, 0, "profile-node-file"); 102 102 urlElement.style.maxWidth = "75%"; 103 103 cell.insertBefore(urlElement, cell.firstChild); -
trunk/Source/WebCore/inspector/front-end/ProfileView.js
r94754 r96500 97 97 } 98 98 99 this._linkifier = new WebInspector.Linkifier(WebInspector.debuggerPresentationModel); 100 99 101 ProfilerAgent.getProfile(this.profile.typeId, this.profile.uid, profileCallback); 100 102 } … … 486 488 this.resetButton.visible = false; 487 489 this.profileDataGridTree.restore(); 490 this._linkiier.reset(); 488 491 this.refresh(); 489 492 this.refreshVisibleData(); -
trunk/Source/WebCore/inspector/front-end/TimelinePanel.js
r95794 r96500 110 110 this._registerShortcuts(); 111 111 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, this._onTimelineEventRecorded, this); 112 this._linkifier = new WebInspector.Linkifier(WebInspector.debuggerPresentationModel); 112 113 } 113 114 … … 117 118 118 119 WebInspector.TimelinePanel.prototype = { 120 _linkifyLocation: function(url, lineNumber, columnNumber) 121 { 122 // FIXME(62725): stack trace line/column numbers are one-based. 123 lineNumber = lineNumber ? lineNumber - 1 : lineNumber; 124 columnNumber = columnNumber ? columnNumber - 1 : 0; 125 return this._linkifier.linkifyLocation(url, lineNumber, columnNumber, "timeline-details"); 126 }, 127 128 _linkifyCallFrame: function(callFrame) 129 { 130 return this._linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.columnNumber); 131 }, 132 119 133 _createTopPane: function() { 120 134 var topPaneElement = document.createElement("div"); … … 529 543 this._closeRecordDetails(); 530 544 this._model._reset(); 545 this._linkifier.reset(); 531 546 }, 532 547 … … 962 977 WebInspector.TimelinePanel.FormattedRecord = function(record, parentRecord, panel, scriptDetails) 963 978 { 979 this._panel = panel; 964 980 var recordTypes = WebInspector.TimelineAgent.RecordType; 965 981 var style = panel._recordStyles[record.type]; … … 1052 1068 _generatePopupContent: function(calculator, categories) 1053 1069 { 1054 var contentHelper = new WebInspector.TimelinePanel.PopupContentHelper(this.title );1070 var contentHelper = new WebInspector.TimelinePanel.PopupContentHelper(this.title, this._panel); 1055 1071 1056 1072 if (this._children && this._children.length) { … … 1137 1153 return WebInspector.UIString("%s collected", Number.bytesToString(this.data.usedHeapSizeDelta)); 1138 1154 case WebInspector.TimelineAgent.RecordType.TimerFire: 1139 return this.scriptName ? this._ linkifyLocation(this.scriptName, this.scriptLine, 0) : this.data.timerId;1155 return this.scriptName ? this._panel._linkifyLocation(this.scriptName, this.scriptLine, 0) : this.data.timerId; 1140 1156 case WebInspector.TimelineAgent.RecordType.FunctionCall: 1141 return this.scriptName ? this._ linkifyLocation(this.scriptName, this.scriptLine, 0) : null;1157 return this.scriptName ? this._panel._linkifyLocation(this.scriptName, this.scriptLine, 0) : null; 1142 1158 case WebInspector.TimelineAgent.RecordType.FireAnimationFrameEvent: 1143 return this.scriptName ? this._ linkifyLocation(this.scriptName, this.scriptLine, 0) : this.data.id;1159 return this.scriptName ? this._panel._linkifyLocation(this.scriptName, this.scriptLine, 0) : this.data.id; 1144 1160 case WebInspector.TimelineAgent.RecordType.EventDispatch: 1145 1161 return this.data ? this.data.type : null; … … 1148 1164 case WebInspector.TimelineAgent.RecordType.TimerInstall: 1149 1165 case WebInspector.TimelineAgent.RecordType.TimerRemove: 1150 return this.stackTrace ? this._ linkifyCallFrame(this.stackTrace[0]) : this.data.timerId;1166 return this.stackTrace ? this._panel._linkifyCallFrame(this.stackTrace[0]) : this.data.timerId; 1151 1167 case WebInspector.TimelineAgent.RecordType.RegisterAnimationFrameCallback: 1152 1168 case WebInspector.TimelineAgent.RecordType.CancelAnimationFrameCallback: 1153 return this.stackTrace ? this._ linkifyCallFrame(this.stackTrace[0]) : this.data.id;1169 return this.stackTrace ? this._panel._linkifyCallFrame(this.stackTrace[0]) : this.data.id; 1154 1170 case WebInspector.TimelineAgent.RecordType.ParseHTML: 1155 1171 case WebInspector.TimelineAgent.RecordType.RecalculateStyles: 1156 return this.stackTrace ? this._ linkifyCallFrame(this.stackTrace[0]) : null;1172 return this.stackTrace ? this._panel._linkifyCallFrame(this.stackTrace[0]) : null; 1157 1173 case WebInspector.TimelineAgent.RecordType.EvaluateScript: 1158 return this.url ? this._ linkifyLocation(this.url, this.data.lineNumber, 0) : null;1174 return this.url ? this._panel._linkifyLocation(this.url, this.data.lineNumber, 0) : null; 1159 1175 case WebInspector.TimelineAgent.RecordType.XHRReadyStateChange: 1160 1176 case WebInspector.TimelineAgent.RecordType.XHRLoad: … … 1172 1188 }, 1173 1189 1174 _linkifyLocation: function(url, lineNumber, columnNumber)1175 {1176 // FIXME(62725): stack trace line/column numbers are one-based.1177 lineNumber = lineNumber ? lineNumber - 1 : lineNumber;1178 columnNumber = columnNumber ? columnNumber - 1 : 0;1179 return WebInspector.debuggerPresentationModel.linkifyLocation(url, lineNumber, columnNumber, "timeline-details");1180 },1181 1182 _linkifyCallFrame: function(callFrame)1183 {1184 return this._linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.columnNumber);1185 },1186 1187 1190 _calculateAggregatedStats: function(categories) 1188 1191 { … … 1205 1208 } 1206 1209 1207 WebInspector.TimelinePanel.PopupContentHelper = function(title )1210 WebInspector.TimelinePanel.PopupContentHelper = function(title, panel) 1208 1211 { 1212 this._panel = panel; 1209 1213 this._contentTable = document.createElement("table");; 1210 1214 var titleCell = this._createCell(WebInspector.UIString("%s - Details", title), "timeline-details-title"); … … 1252 1256 _appendLinkRow: function(title, scriptName, scriptLine) 1253 1257 { 1254 var link = WebInspector.TimelinePanel.FormattedRecord.prototype._linkifyLocation(scriptName, scriptLine, 0, "timeline-details");1258 var link = this._panel._linkifyLocation(scriptName, scriptLine, 0, "timeline-details"); 1255 1259 this._appendElementRow(title, link); 1256 1260 }, … … 1267 1271 row.appendChild(this._createCell(" @ ")); 1268 1272 var linkCell = document.createElement("td"); 1269 var urlElement = WebInspector.TimelinePanel.FormattedRecord.prototype._linkifyCallFrame(stackFrame);1273 var urlElement = this._panel._linkifyCallFrame(stackFrame); 1270 1274 linkCell.appendChild(urlElement); 1271 1275 row.appendChild(linkCell); -
trunk/Source/WebCore/inspector/front-end/WebKit.qrc
r96313 r96500 37 37 <file>DebuggerModel.js</file> 38 38 <file>DebuggerPresentationModel.js</file> 39 <file>Linkifier.js</file> 39 40 <file>DOMAgent.js</file> 40 41 <file>DOMBreakpointsSidebarPane.js</file> -
trunk/Source/WebCore/inspector/front-end/inspector.html
r96499 r96500 159 159 <script type="text/javascript" src="DebuggerModel.js"></script> 160 160 <script type="text/javascript" src="DebuggerPresentationModel.js"></script> 161 <script type="text/javascript" src="Linkifier.js"></script> 161 162 <script type="text/javascript" src="BreakpointManager.js"></script> 162 163 <script type="text/javascript" src="UISourceCode.js"></script> -
trunk/Source/WebCore/inspector/front-end/inspector.js
r96499 r96500 510 510 this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated, this._updateErrorAndWarningCounts, this); 511 511 512 this.debuggerModel = new WebInspector.DebuggerModel(); 513 this.debuggerPresentationModel = new WebInspector.DebuggerPresentationModel(); 514 512 515 this.drawer = new WebInspector.Drawer(); 513 516 this.consoleView = new WebInspector.ConsoleView(); … … 522 525 523 526 this.cssModel = new WebInspector.CSSStyleModel(); 524 this.debuggerModel = new WebInspector.DebuggerModel();525 this.debuggerPresentationModel = new WebInspector.DebuggerPresentationModel();526 527 527 528 this.searchController = new WebInspector.SearchController();
Note: See TracChangeset
for help on using the changeset viewer.