[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 01:12:43 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 661dd3458f9f0883270ce13cffd3ae918c35a936
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 18 14:20:51 2010 +0000

    2010-01-18  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Improve Resources panel performance for lots of resources
    
            DOM properties are extracted into const's, comparisons are faster.
            https://bugs.webkit.org/show_bug.cgi?id=33790
    
            * inspector/front-end/AbstractTimelinePanel.js:
            (WebInspector.AbstractTimelinePanel.prototype._updateDividersLabelBarPosition):
            * inspector/front-end/Resource.js:
            (WebInspector.Resource.CompareByStartTime):
            (WebInspector.Resource.CompareByResponseReceivedTime):
            (WebInspector.Resource.CompareByEndTime):
            (WebInspector.Resource.CompareByDuration):
            (WebInspector.Resource.CompareByLatency):
            (WebInspector.Resource.CompareBySize):
            * inspector/front-end/ResourcesPanel.js:
            (WebInspector.ResourceGraph.prototype.refreshLabelPositions):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53405 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dcd977d..0a9c8c0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-01-18  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Improve Resources panel performance for lots of resources
+
+        DOM properties are extracted into const's, comparisons are faster.
+        https://bugs.webkit.org/show_bug.cgi?id=33790
+
+        * inspector/front-end/AbstractTimelinePanel.js:
+        (WebInspector.AbstractTimelinePanel.prototype._updateDividersLabelBarPosition):
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.CompareByStartTime):
+        (WebInspector.Resource.CompareByResponseReceivedTime):
+        (WebInspector.Resource.CompareByEndTime):
+        (WebInspector.Resource.CompareByDuration):
+        (WebInspector.Resource.CompareByLatency):
+        (WebInspector.Resource.CompareBySize):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourceGraph.prototype.refreshLabelPositions):
+
 2010-01-18  Daniel Bates  <dbates at rim.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/inspector/front-end/AbstractTimelinePanel.js b/WebCore/inspector/front-end/AbstractTimelinePanel.js
index c5180f6..05af9c2 100644
--- a/WebCore/inspector/front-end/AbstractTimelinePanel.js
+++ b/WebCore/inspector/front-end/AbstractTimelinePanel.js
@@ -215,8 +215,9 @@ WebInspector.AbstractTimelinePanel.prototype = {
 
     _updateDividersLabelBarPosition: function()
     {
-        var scrollTop = this.containerElement.scrollTop;
-        var dividersTop = (scrollTop < this.summaryBar.element.offsetHeight ? this.summaryBar.element.offsetHeight : scrollTop);
+        const scrollTop = this.containerElement.scrollTop;
+        const offsetHeight = this.summaryBar.element.offsetHeight;
+        const dividersTop = (scrollTop < offsetHeight ? offsetHeight : scrollTop);
         this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop);
     },
 
diff --git a/WebCore/inspector/front-end/Resource.js b/WebCore/inspector/front-end/Resource.js
index d292e19..9860300 100644
--- a/WebCore/inspector/front-end/Resource.js
+++ b/WebCore/inspector/front-end/Resource.js
@@ -570,64 +570,40 @@ WebInspector.Resource.prototype.__proto__ = WebInspector.Object.prototype;
 
 WebInspector.Resource.CompareByStartTime = function(a, b)
 {
-    if (a.startTime < b.startTime)
-        return -1;
-    if (a.startTime > b.startTime)
-        return 1;
-    return 0;
+    return a.startTime - b.startTime;
 }
 
 WebInspector.Resource.CompareByResponseReceivedTime = function(a, b)
 {
-    if (a.responseReceivedTime === -1 && b.responseReceivedTime !== -1)
-        return 1;
-    if (a.responseReceivedTime !== -1 && b.responseReceivedTime === -1)
-        return -1;
-    if (a.responseReceivedTime < b.responseReceivedTime)
-        return -1;
-    if (a.responseReceivedTime > b.responseReceivedTime)
-        return 1;
-    return 0;
+    var aVal = a.responseReceivedTime;
+    var bVal = b.responseReceivedTime;
+    if (aVal === -1 ^ bVal === -1)
+        return bVal - aVal;
+    return aVal - bVal;
 }
 
 WebInspector.Resource.CompareByEndTime = function(a, b)
 {
-    if (a.endTime === -1 && b.endTime !== -1)
-        return 1;
-    if (a.endTime !== -1 && b.endTime === -1)
-        return -1;
-    if (a.endTime < b.endTime)
-        return -1;
-    if (a.endTime > b.endTime)
-        return 1;
-    return 0;
+    var aVal = a.endTime;
+    var bVal = b.endTime;
+    if (aVal === -1 ^ bVal === -1)
+        return bVal - aVal;
+    return aVal - bVal;
 }
 
 WebInspector.Resource.CompareByDuration = function(a, b)
 {
-    if (a.duration < b.duration)
-        return -1;
-    if (a.duration > b.duration)
-        return 1;
-    return 0;
+    return a.duration - b.duration;
 }
 
 WebInspector.Resource.CompareByLatency = function(a, b)
 {
-    if (a.latency < b.latency)
-        return -1;
-    if (a.latency > b.latency)
-        return 1;
-    return 0;
+    return a.latency - b.latency;
 }
 
 WebInspector.Resource.CompareBySize = function(a, b)
 {
-    if (a.contentLength < b.contentLength)
-        return -1;
-    if (a.contentLength > b.contentLength)
-        return 1;
-    return 0;
+    return a.contentLength - b.contentLength;
 }
 
 WebInspector.Resource.StatusTextForCode = function(code)
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index 13bc1f2..0347294 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -1187,14 +1187,19 @@ WebInspector.ResourceGraph.prototype = {
         this._labelRightElement.removeStyleClass("hidden");
 
         const labelPadding = 10;
-        const rightBarWidth = (this._barRightElement.offsetWidth - labelPadding);
-        const leftBarWidth = ((this._barLeftElement.offsetWidth - this._barRightElement.offsetWidth) - labelPadding);
+        const barRightElementOffsetWidth = this._barRightElement.offsetWidth;
+        const barLeftElementOffsetWidth = this._barLeftElement.offsetWidth;
+        const rightBarWidth = (barRightElementOffsetWidth - labelPadding);
+        const leftBarWidth = ((barLeftElementOffsetWidth - barRightElementOffsetWidth) - labelPadding);
+        const labelLeftElementOffsetWidth = this._labelLeftElement.offsetWidth;
+        const labelRightElementOffsetWidth = this._labelRightElement.offsetWidth;
 
-        var labelBefore = (this._labelLeftElement.offsetWidth > leftBarWidth);
-        var labelAfter = (this._labelRightElement.offsetWidth > rightBarWidth);
+        const labelBefore = (labelLeftElementOffsetWidth > leftBarWidth);
+        const labelAfter = (labelRightElementOffsetWidth > rightBarWidth);
+        const graphElementOffsetWidth = this._graphElement.offsetWidth;
 
         if (labelBefore) {
-            if ((this._graphElement.offsetWidth * (this._percentages.start / 100)) < (this._labelLeftElement.offsetWidth + 10))
+            if ((graphElementOffsetWidth * (this._percentages.start / 100)) < (labelLeftElementOffsetWidth + 10))
                 this._labelLeftElement.addStyleClass("hidden");
             this._labelLeftElement.style.setProperty("right", (100 - this._percentages.start) + "%");
             this._labelLeftElement.addStyleClass("before");
@@ -1204,7 +1209,7 @@ WebInspector.ResourceGraph.prototype = {
         }
 
         if (labelAfter) {
-            if ((this._graphElement.offsetWidth * ((100 - this._percentages.end) / 100)) < (this._labelRightElement.offsetWidth + 10))
+            if ((graphElementOffsetWidth * ((100 - this._percentages.end) / 100)) < (labelRightElementOffsetWidth + 10))
                 this._labelRightElement.addStyleClass("hidden");
             this._labelRightElement.style.setProperty("left", this._percentages.end + "%");
             this._labelRightElement.addStyleClass("after");

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list