Diff
Modified: branches/safari-600.1-branch/Source/WebInspectorUI/ChangeLog (172781 => 172782)
--- branches/safari-600.1-branch/Source/WebInspectorUI/ChangeLog 2014-08-19 23:33:42 UTC (rev 172781)
+++ branches/safari-600.1-branch/Source/WebInspectorUI/ChangeLog 2014-08-19 23:35:53 UTC (rev 172782)
@@ -1,5 +1,43 @@
2014-08-19 Dana Burkart <[email protected]>
+ Merge r172689. <rdar://problem/18040028>
+
+ 2014-08-16 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Improve performance of selection range changes viewing Scripts timeline
+ https://bugs.webkit.org/show_bug.cgi?id=136015
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Utilities.js:
+ (clamp):
+ Helper function to clamp a value between a min and max.
+
+ * UserInterface/Models/ProfileNode.js:
+ (WebInspector.ProfileNode.prototype.get startTime):
+ (WebInspector.ProfileNode.prototype.get endTime):
+ These can be quickly calculated, so avoid full calculation to grab the values.
+
+ * UserInterface/Views/ScriptTimelineView.js:
+ (WebInspector.ScriptTimelineView.prototype.updateLayout):
+ Update ranges with a smart helper, instead of blindly doing it and needing refresh.
+
+ * UserInterface/Views/ProfileNodeDataGridNode.js:
+ (WebInspector.ProfileNodeDataGridNode.prototype.get rangeEndTime):
+ (WebInspector.ProfileNodeDataGridNode.prototype.get data):
+ (WebInspector.ProfileNodeDataGridNode.prototype.updateRangeTimes):
+ (WebInspector.ProfileNodeDataGridNode.prototype.set rangeStartTime): Deleted.
+ (WebInspector.ProfileNodeDataGridNode.prototype.set rangeEndTime): Deleted.
+ * UserInterface/Views/ScriptTimelineDataGridNode.js:
+ (WebInspector.ScriptTimelineDataGridNode.prototype.updateRangeTimes):
+ (WebInspector.ScriptTimelineDataGridNode.prototype.set rangeStartTime): Deleted.
+ (WebInspector.ScriptTimelineDataGridNode.prototype.set rangeEndTime): Deleted.
+ When updating the range selection, compare to the last range selection
+ on this DataGridNode. If the visible portion of this node's time range
+ changes, we need a refresh. Otherwise, we don't need a refresh.
+
+2014-08-19 Dana Burkart <[email protected]>
+
Merge r172682. <rdar://problem/18038767>
2014-08-15 Joseph Pecoraro <[email protected]>
Modified: branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Base/Utilities.js (172781 => 172782)
--- branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2014-08-19 23:33:42 UTC (rev 172781)
+++ branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2014-08-19 23:35:53 UTC (rev 172782)
@@ -1015,6 +1015,11 @@
}
});
+function clamp(min, value, max)
+{
+ return Math.min(Math.max(min, value), max);
+}
+
function insertionIndexForObjectInListSortedByFunction(object, list, comparator, insertionIndexAfter)
{
if (insertionIndexAfter) {
Modified: branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Models/ProfileNode.js (172781 => 172782)
--- branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Models/ProfileNode.js 2014-08-19 23:33:42 UTC (rev 172781)
+++ branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Models/ProfileNode.js 2014-08-19 23:35:53 UTC (rev 172782)
@@ -94,13 +94,15 @@
get startTime()
{
- this._computeTotalTimesIfNeeded();
+ if (this._startTime === undefined)
+ this._startTime = Math.max(0, this._calls[0].startTime);
return this._startTime;
},
get endTime()
{
- this._computeTotalTimesIfNeeded();
+ if (this._endTime === undefined)
+ this._endTime = Math.min(this._calls.lastValue.endTime, Infinity);
return this._endTime;
},
Modified: branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js (172781 => 172782)
--- branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js 2014-08-19 23:33:42 UTC (rev 172781)
+++ branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js 2014-08-19 23:35:53 UTC (rev 172782)
@@ -68,32 +68,37 @@
return this._rangeStartTime;
},
- set rangeStartTime(x)
+ get rangeEndTime()
{
- if (this._rangeStartTime === x)
- return;
-
- this._rangeStartTime = x;
- this.needsRefresh();
+ return this._rangeEndTime;
},
- get rangeEndTime()
+ get data()
{
- return this._rangeEndTime;
+ return this._data;
},
- set rangeEndTime(x)
+ updateRangeTimes: function(startTime, endTime)
{
- if (this._rangeEndTime === x)
+ var oldRangeStartTime = this._rangeStartTime;
+ var oldRangeEndTime = this._rangeEndTime;
+
+ if (oldRangeStartTime === startTime && oldRangeEndTime === endTime)
return;
- this._rangeEndTime = x;
- this.needsRefresh();
- },
+ this._rangeStartTime = startTime;
+ this._rangeEndTime = endTime;
- get data()
- {
- return this._data;
+ // We only need a refresh if the new range time changes the visible portion of this record.
+ var profileStart = this._profileNode.startTime;
+ var profileEnd = this._profileNode.endTime;
+ var oldStartBoundary = clamp(profileStart, oldRangeStartTime, profileEnd);
+ var oldEndBoundary = clamp(profileStart, oldRangeEndTime, profileEnd);
+ var newStartBoundary = clamp(profileStart, startTime, profileEnd);
+ var newEndBoundary = clamp(profileStart, endTime, profileEnd);
+
+ if (oldStartBoundary !== newStartBoundary || oldEndBoundary !== newEndBoundary)
+ this.needsRefresh();
},
refresh: function()
Modified: branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js (172781 => 172782)
--- branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js 2014-08-19 23:33:42 UTC (rev 172781)
+++ branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js 2014-08-19 23:35:53 UTC (rev 172782)
@@ -63,29 +63,11 @@
return this._rangeStartTime;
},
- set rangeStartTime(x)
- {
- if (this._rangeStartTime === x)
- return;
-
- this._rangeStartTime = x;
- this.needsRefresh();
- },
-
get rangeEndTime()
{
return this._rangeEndTime;
},
- set rangeEndTime(x)
- {
- if (this._rangeEndTime === x)
- return;
-
- this._rangeEndTime = x;
- this.needsRefresh();
- },
-
get data()
{
var startTime = Math.max(this._rangeStartTime, this._record.startTime);
@@ -96,6 +78,33 @@
averageTime: duration, callCount: 1, location: callFrameOrSourceCodeLocation};
},
+ updateRangeTimes: function(startTime, endTime)
+ {
+ var oldRangeStartTime = this._rangeStartTime;
+ var oldRangeEndTime = this._rangeEndTime;
+
+ if (oldRangeStartTime === startTime && oldRangeEndTime === endTime)
+ return;
+
+ this._rangeStartTime = startTime;
+ this._rangeEndTime = endTime;
+
+ // If we have no duration the range does not matter.
+ if (!this._record.duration)
+ return;
+
+ // We only need a refresh if the new range time changes the visible portion of this record.
+ var recordStart = this._record.startTime;
+ var recordEnd = this._record.startTime + this._record.duration;
+ var oldStartBoundary = clamp(recordStart, oldRangeStartTime, recordEnd);
+ var oldEndBoundary = clamp(recordStart, oldRangeEndTime, recordEnd);
+ var newStartBoundary = clamp(recordStart, startTime, recordEnd);
+ var newEndBoundary = clamp(recordStart, endTime, recordEnd);
+
+ if (oldStartBoundary !== newStartBoundary || oldEndBoundary !== newEndBoundary)
+ this.needsRefresh();
+ },
+
createCellContent: function(columnIdentifier, cell)
{
const emptyValuePlaceholderString = "\u2014";
Modified: branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js (172781 => 172782)
--- branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js 2014-08-19 23:33:42 UTC (rev 172781)
+++ branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js 2014-08-19 23:35:53 UTC (rev 172782)
@@ -111,8 +111,7 @@
if (this.startTime !== this._oldStartTime || this.endTime !== this._oldEndTime) {
var dataGridNode = this._dataGrid.children[0];
while (dataGridNode) {
- dataGridNode.rangeStartTime = this.startTime;
- dataGridNode.rangeEndTime = this.endTime;
+ dataGridNode.updateRangeTimes(this.startTime, this.endTime);
if (dataGridNode.revealed)
dataGridNode.refreshIfNeeded();
dataGridNode = dataGridNode.traverseNextNode(false, null, true);