From 65f03d4f644ce73618e5f4f50dd694b26f55ae12 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 13 May 2011 16:23:25 +0100 Subject: Merge WebKit at r75993: Initial merge by git. Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3 --- .../WebCore/inspector/front-end/TimelinePanel.js | 53 ++++++++++++++++------ 1 file changed, 38 insertions(+), 15 deletions(-) (limited to 'Source/WebCore/inspector/front-end/TimelinePanel.js') diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index a661b75..1d8b9c9 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -83,7 +83,7 @@ WebInspector.TimelinePanel = function() this._calculator = new WebInspector.TimelineCalculator(); this._calculator._showShortEvents = false; - var shortRecordThresholdTitle = Number.secondsToString(WebInspector.TimelinePanel.shortRecordThreshold, WebInspector.UIString); + var shortRecordThresholdTitle = Number.secondsToString(WebInspector.TimelinePanel.shortRecordThreshold); this._showShortRecordsTitleText = WebInspector.UIString("Show the records that are shorter than %s", shortRecordThresholdTitle); this._hideShortRecordsTitleText = WebInspector.UIString("Hide the records that are shorter than %s", shortRecordThresholdTitle); this._createStatusbarButtons(); @@ -99,7 +99,7 @@ WebInspector.TimelinePanel = function() this._markTimelineRecords = []; this._expandOffset = 15; - InspectorBackend.registerDomainDispatcher("Timeline", this); + InspectorBackend.registerDomainDispatcher("Timeline", new WebInspector.TimelineDispatcher(this)); } // Define row height, should be in sync with styles for timeline graphs. @@ -285,20 +285,21 @@ WebInspector.TimelinePanel.prototype = { this._scheduleRefresh(true); }, - timelineProfilerWasStarted: function() + _timelineProfilerWasStarted: function() { this.toggleTimelineButton.toggled = true; }, - timelineProfilerWasStopped: function() + _timelineProfilerWasStopped: function() { this.toggleTimelineButton.toggled = false; }, - addRecordToTimeline: function(record) + _addRecordToTimeline: function(record) { - if (record.type == WebInspector.TimelineAgent.RecordType.ResourceSendRequest && record.data.isMainResource) { - if (this._mainResourceIdentifier != record.data.identifier) { + if (record.type == WebInspector.TimelineAgent.RecordType.ResourceSendRequest) { + var isMainResource = (record.data.identifier === WebInspector.mainResource.identifier); + if (isMainResource && this._mainResourceIdentifier !== record.data.identifier) { // We are loading new main resource -> clear the panel. Check above is necessary since // there may be several resource loads with main resource marker upon redirects, redirects are reported with // the original identifier. @@ -642,6 +643,28 @@ WebInspector.TimelinePanel.prototype = { WebInspector.TimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype; +WebInspector.TimelineDispatcher = function(timelinePanel) +{ + this._timelinePanel = timelinePanel; +} + +WebInspector.TimelineDispatcher.prototype = { + timelineProfilerWasStarted: function() + { + this._timelinePanel._timelineProfilerWasStarted(); + }, + + timelineProfilerWasStopped: function() + { + this._timelinePanel._timelineProfilerWasStopped(); + }, + + addRecordToTimeline: function(record) + { + this._timelinePanel._addRecordToTimeline(record); + } +} + WebInspector.TimelineCategory = function(name, title, color) { this.name = name; @@ -709,7 +732,7 @@ WebInspector.TimelineCalculator.prototype = { formatValue: function(value) { - return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, WebInspector.UIString); + return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary); } } @@ -907,7 +930,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { label.className = "timeline-aggregated-category timeline-" + index; cell.appendChild(label); var text = document.createElement("span"); - text.textContent = Number.secondsToString(this._aggregatedStats[index] + 0.0001, WebInspector.UIString); + text.textContent = Number.secondsToString(this._aggregatedStats[index] + 0.0001); cell.appendChild(text); } return cell; @@ -918,10 +941,10 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { var contentHelper = new WebInspector.TimelinePanel.PopupContentHelper(this.title); if (this._children && this._children.length) { - contentHelper._appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime + 0.0001, WebInspector.UIString)); + contentHelper._appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime + 0.0001)); contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"), this._generateAggregatedInfo()); } - var text = WebInspector.UIString("%s (at %s)", Number.secondsToString(this._lastChildEndTime - this.startTime, WebInspector.UIString), + var text = WebInspector.UIString("%s (at %s)", Number.secondsToString(this._lastChildEndTime - this.startTime), calculator.formatValue(this.startTime - calculator.minimumBoundary)); contentHelper._appendTextRow(WebInspector.UIString("Duration"), text); @@ -929,14 +952,14 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { switch (this.type) { case recordTypes.GCEvent: - contentHelper._appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data.usedHeapSizeDelta, WebInspector.UIString)); + contentHelper._appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data.usedHeapSizeDelta)); break; case recordTypes.TimerInstall: case recordTypes.TimerFire: case recordTypes.TimerRemove: contentHelper._appendTextRow(WebInspector.UIString("Timer ID"), this.data.timerId); if (typeof this.timeout === "number") { - contentHelper._appendTextRow(WebInspector.UIString("Timeout"), Number.secondsToString(this.timeout / 1000, WebInspector.UIString)); + contentHelper._appendTextRow(WebInspector.UIString("Timeout"), Number.secondsToString(this.timeout / 1000)); contentHelper._appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot); } break; @@ -977,7 +1000,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { contentHelper._appendLinkRow(WebInspector.UIString("Function Call"), this.data.scriptName, this.data.scriptLine); if (this.usedHeapSize) - contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"), WebInspector.UIString("%s of %s", Number.bytesToString(this.usedHeapSize, WebInspector.UIString), Number.bytesToString(this.totalHeapSize, WebInspector.UIString))); + contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"), WebInspector.UIString("%s of %s", Number.bytesToString(this.usedHeapSize), Number.bytesToString(this.totalHeapSize))); if (this.callSiteStackTrace && this.callSiteStackTrace.length) contentHelper._appendStackTrace(WebInspector.UIString("Call Site stack"), this.callSiteStackTrace); @@ -992,7 +1015,7 @@ WebInspector.TimelinePanel.FormattedRecord.prototype = { { switch (record.type) { case WebInspector.TimelineAgent.RecordType.GCEvent: - return WebInspector.UIString("%s collected", Number.bytesToString(record.data.usedHeapSizeDelta, WebInspector.UIString)); + return WebInspector.UIString("%s collected", Number.bytesToString(record.data.usedHeapSizeDelta)); case WebInspector.TimelineAgent.RecordType.TimerFire: return record.data.scriptName ? WebInspector.linkifyResourceAsNode(record.data.scriptName, "scripts", record.data.scriptLine, "", "") : record.data.timerId; case WebInspector.TimelineAgent.RecordType.FunctionCall: -- cgit v1.1