Title: [126432] trunk/Source/WebCore
Revision
126432
Author
[email protected]
Date
2012-08-23 08:46:13 -0700 (Thu, 23 Aug 2012)

Log Message

Web Inspector: introduce TimelineGrid.Calculator interface.
https://bugs.webkit.org/show_bug.cgi?id=94819

Reviewed by Alexander Pavlov.

This way we can compile TimelineGrid properly.

* inspector/front-end/MemoryStatistics.js:
(WebInspector.MemoryStatistics.prototype._calculateVisibleIndexes):
* inspector/front-end/TimelineGrid.js:
(WebInspector.TimelineGrid.prototype.updateDividers):
(WebInspector.TimelineGrid.Calculator):
(WebInspector.TimelineGrid.Calculator.prototype.computePosition):
(WebInspector.TimelineGrid.Calculator.prototype.formatTime):
(WebInspector.TimelineGrid.Calculator.prototype.minimumBoundary):
(WebInspector.TimelineGrid.Calculator.prototype.maximumBoundary):
(WebInspector.TimelineGrid.Calculator.prototype.boundarySpan):
* inspector/front-end/TimelineOverviewPane.js:
(WebInspector.TimelineOverviewCalculator.prototype.computePosition):
(WebInspector.TimelineOverviewCalculator.prototype.computeBarGraphPercentages):
(WebInspector.TimelineOverviewCalculator.prototype.setWindow):
(WebInspector.TimelineOverviewCalculator.prototype.formatTime):
(WebInspector.TimelineOverviewCalculator.prototype.maximumBoundary):
(WebInspector.TimelineOverviewCalculator.prototype.minimumBoundary):
(WebInspector.TimelineOverviewCalculator.prototype.boundarySpan):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype._shouldShowFrames):
(WebInspector.TimelineCalculator.prototype.computePosition):
(WebInspector.TimelineCalculator.prototype.computeBarGraphPercentages):
(WebInspector.TimelineCalculator.prototype.setWindow):
(WebInspector.TimelineCalculator.prototype.formatTime):
(WebInspector.TimelineCalculator.prototype.maximumBoundary):
(WebInspector.TimelineCalculator.prototype.minimumBoundary):
(WebInspector.TimelineCalculator.prototype.boundarySpan):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126431 => 126432)


--- trunk/Source/WebCore/ChangeLog	2012-08-23 15:42:33 UTC (rev 126431)
+++ trunk/Source/WebCore/ChangeLog	2012-08-23 15:46:13 UTC (rev 126432)
@@ -1,3 +1,40 @@
+2012-08-23  Pavel Feldman  <[email protected]>
+
+        Web Inspector: introduce TimelineGrid.Calculator interface.
+        https://bugs.webkit.org/show_bug.cgi?id=94819
+
+        Reviewed by Alexander Pavlov.
+
+        This way we can compile TimelineGrid properly.
+
+        * inspector/front-end/MemoryStatistics.js:
+        (WebInspector.MemoryStatistics.prototype._calculateVisibleIndexes):
+        * inspector/front-end/TimelineGrid.js:
+        (WebInspector.TimelineGrid.prototype.updateDividers):
+        (WebInspector.TimelineGrid.Calculator):
+        (WebInspector.TimelineGrid.Calculator.prototype.computePosition):
+        (WebInspector.TimelineGrid.Calculator.prototype.formatTime):
+        (WebInspector.TimelineGrid.Calculator.prototype.minimumBoundary):
+        (WebInspector.TimelineGrid.Calculator.prototype.maximumBoundary):
+        (WebInspector.TimelineGrid.Calculator.prototype.boundarySpan):
+        * inspector/front-end/TimelineOverviewPane.js:
+        (WebInspector.TimelineOverviewCalculator.prototype.computePosition):
+        (WebInspector.TimelineOverviewCalculator.prototype.computeBarGraphPercentages):
+        (WebInspector.TimelineOverviewCalculator.prototype.setWindow):
+        (WebInspector.TimelineOverviewCalculator.prototype.formatTime):
+        (WebInspector.TimelineOverviewCalculator.prototype.maximumBoundary):
+        (WebInspector.TimelineOverviewCalculator.prototype.minimumBoundary):
+        (WebInspector.TimelineOverviewCalculator.prototype.boundarySpan):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.prototype._shouldShowFrames):
+        (WebInspector.TimelineCalculator.prototype.computePosition):
+        (WebInspector.TimelineCalculator.prototype.computeBarGraphPercentages):
+        (WebInspector.TimelineCalculator.prototype.setWindow):
+        (WebInspector.TimelineCalculator.prototype.formatTime):
+        (WebInspector.TimelineCalculator.prototype.maximumBoundary):
+        (WebInspector.TimelineCalculator.prototype.minimumBoundary):
+        (WebInspector.TimelineCalculator.prototype.boundarySpan):
+
 2012-08-23  David Reveman  <[email protected]>
 
         [Chromium] Unnecessary delay when starting to update resources with an inactive vsync timer.

Modified: trunk/Source/WebCore/inspector/front-end/MemoryStatistics.js (126431 => 126432)


--- trunk/Source/WebCore/inspector/front-end/MemoryStatistics.js	2012-08-23 15:42:33 UTC (rev 126431)
+++ trunk/Source/WebCore/inspector/front-end/MemoryStatistics.js	2012-08-23 15:46:13 UTC (rev 126432)
@@ -287,8 +287,8 @@
     _calculateVisibleIndexes: function()
     {
         var calculator = this._timelinePanel.calculator;
-        var start = calculator.minimumBoundary * 1000;
-        var end = calculator.maximumBoundary * 1000;
+        var start = calculator.minimumBoundary() * 1000;
+        var end = calculator.maximumBoundary() * 1000;
         var firstIndex = 0;
         var lastIndex = this._counters.length - 1;
         for (var i = 0; i < this._counters.length; i++) {

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (126431 => 126432)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2012-08-23 15:42:33 UTC (rev 126431)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2012-08-23 15:46:13 UTC (rev 126432)
@@ -1191,7 +1191,8 @@
     /**
      * @param {string} query
      */
-    performFilter: function(query) {
+    performFilter: function(query)
+    {
         this._filteredOutRequests.clear();
         var filterRegExp = createPlainTextSearchRegex(query, "i");
         var shownRequests = [];
@@ -1471,10 +1472,11 @@
     /**
      * @param {string} query
      */    
-    performFilter: function(query){
+    performFilter: function(query)
+    {
         this._networkLogView.performFilter(query);
     },
-    
+
     jumpToPreviousSearchResult: function()
     {
         this._networkLogView.jumpToPreviousSearchResult();
@@ -1514,6 +1516,7 @@
 
 /**
  * @constructor
+ * @implements {WebInspector.TimelineGrid.Calculator}
  */
 WebInspector.NetworkBaseCalculator = function()
 {
@@ -1522,12 +1525,12 @@
 WebInspector.NetworkBaseCalculator.prototype = {
     computePosition: function(time)
     {
-        return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea;
+        return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea;
     },
 
     computeBarGraphPercentages: function(item)
     {
-        return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100};
+        return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan()) * 100};
     },
 
     computeBarGraphLabels: function(item)
@@ -1536,18 +1539,18 @@
         return {left: label, right: label, tooltip: label};
     },
 
-    get boundarySpan()
+    boundarySpan: function()
     {
-        return this.maximumBoundary - this.minimumBoundary;
+        return this._maximumBoundary - this._minimumBoundary;
     },
 
     updateBoundaries: function(item)
     {
-        this.minimumBoundary = 0;
+        this._minimumBoundary = 0;
 
         var value = this._value(item);
-        if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) {
-            this.maximumBoundary = value;
+        if (typeof this._maximumBoundary === "undefined" || value > this._maximumBoundary) {
+            this._maximumBoundary = value;
             return true;
         }
         return false;
@@ -1555,10 +1558,20 @@
 
     reset: function()
     {
-        delete this.minimumBoundary;
-        delete this.maximumBoundary;
+        delete this._minimumBoundary;
+        delete this._maximumBoundary;
     },
 
+    maximumBoundary: function()
+    {
+        return this._maximumBoundary;
+    },
+
+    minimumBoundary: function()
+    {
+        return this._minimumBoundary;
+    },
+
     _value: function(item)
     {
         return 0;
@@ -1590,17 +1603,17 @@
     computeBarGraphPercentages: function(request)
     {
         if (request.startTime !== -1)
-            var start = ((request.startTime - this.minimumBoundary) / this.boundarySpan) * 100;
+            var start = ((request.startTime - this._minimumBoundary) / this.boundarySpan()) * 100;
         else
             var start = 0;
 
         if (request.responseReceivedTime !== -1)
-            var middle = ((request.responseReceivedTime - this.minimumBoundary) / this.boundarySpan) * 100;
+            var middle = ((request.responseReceivedTime - this._minimumBoundary) / this.boundarySpan()) * 100;
         else
             var middle = (this.startAtZero ? start : 100);
 
         if (request.endTime !== -1)
-            var end = ((request.endTime - this.minimumBoundary) / this.boundarySpan) * 100;
+            var end = ((request.endTime - this._minimumBoundary) / this.boundarySpan()) * 100;
         else
             var end = (this.startAtZero ? middle : 100);
 
@@ -1619,7 +1632,7 @@
         // of a specific event. If startAtZero is set, then this is useless, and we
         // want to return 0.
         if (eventTime !== -1 && !this.startAtZero)
-            return ((eventTime - this.minimumBoundary) / this.boundarySpan) * 100;
+            return ((eventTime - this._minimumBoundary) / this.boundarySpan()) * 100;
 
         return 0;
     },
@@ -1629,8 +1642,8 @@
         if (eventTime === -1 || this.startAtZero)
             return false;
 
-        if (typeof this.maximumBoundary === "undefined" || eventTime > this.maximumBoundary) {
-            this.maximumBoundary = eventTime;
+        if (typeof this._maximumBoundary === "undefined" || eventTime > this._maximumBoundary) {
+            this._maximumBoundary = eventTime;
             return true;
         }
         return false;
@@ -1674,14 +1687,14 @@
         else
             lowerBound = this._lowerBound(request);
 
-        if (lowerBound !== -1 && (typeof this.minimumBoundary === "undefined" || lowerBound < this.minimumBoundary)) {
-            this.minimumBoundary = lowerBound;
+        if (lowerBound !== -1 && (typeof this._minimumBoundary === "undefined" || lowerBound < this._minimumBoundary)) {
+            this._minimumBoundary = lowerBound;
             didChange = true;
         }
 
         var upperBound = this._upperBound(request);
-        if (upperBound !== -1 && (typeof this.maximumBoundary === "undefined" || upperBound > this.maximumBoundary)) {
-            this.maximumBoundary = upperBound;
+        if (upperBound !== -1 && (typeof this._maximumBoundary === "undefined" || upperBound > this._maximumBoundary)) {
+            this._maximumBoundary = upperBound;
             didChange = true;
         }
 

Modified: trunk/Source/WebCore/inspector/front-end/TimelineGrid.js (126431 => 126432)


--- trunk/Source/WebCore/inspector/front-end/TimelineGrid.js	2012-08-23 15:42:33 UTC (rev 126431)
+++ trunk/Source/WebCore/inspector/front-end/TimelineGrid.js	2012-08-23 15:46:13 UTC (rev 126432)
@@ -132,7 +132,7 @@
                 left = dividersElementClientWidth / dividerCount * i + paddingLeft;
                 dividerLabelBar._labelElement.textContent = "";
             } else {
-                left = calculator.computePosition(calculator.minimumBoundary + slice * i);
+                left = calculator.computePosition(calculator.minimumBoundary() + slice * i);
                 dividerLabelBar._labelElement.textContent = calculator.formatTime(slice * i);
             }
             var percentLeft = 100 * left / dividersElementClientWidth;
@@ -200,3 +200,25 @@
         this._dividersElement.style.top = scrollTop + "px";
     }
 }
+
+/**
+ * @interface
+ */
+WebInspector.TimelineGrid.Calculator = function() { }
+
+WebInspector.TimelineGrid.Calculator.prototype = {
+    /** @param {number} time */
+    computePosition: function(time) { },
+
+    /** @param {number} time */
+    formatTime: function(time) { },
+
+    /** @return {number} */
+    minimumBoundary: function() { },
+
+    /** @return {number} */
+    maximumBoundary: function() { },
+
+    /** @return {number} */
+    boundarySpan: function() { }
+}

Modified: trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js (126431 => 126432)


--- trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js	2012-08-23 15:42:33 UTC (rev 126431)
+++ trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js	2012-08-23 15:46:13 UTC (rev 126432)
@@ -652,13 +652,13 @@
      */
     computePosition: function(time)
     {
-        return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea + this.paddingLeft;
+        return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea + this.paddingLeft;
     },
 
     computeBarGraphPercentages: function(record)
     {
-        var start = (WebInspector.TimelineModel.startTimeInSeconds(record) - this.minimumBoundary) / this.boundarySpan * 100;
-        var end = (WebInspector.TimelineModel.endTimeInSeconds(record) - this.minimumBoundary) / this.boundarySpan * 100;
+        var start = (WebInspector.TimelineModel.startTimeInSeconds(record) - this._minimumBoundary) / this.boundarySpan() * 100;
+        var end = (WebInspector.TimelineModel.endTimeInSeconds(record) - this._minimumBoundary) / this.boundarySpan() * 100;
         return {start: start, end: end};
     },
 
@@ -668,9 +668,8 @@
      */
     setWindow: function(minimum, maximum)
     {
-        this.minimumBoundary = minimum >= 0 ? minimum : undefined;
-        this.maximumBoundary = maximum >= 0 ? maximum : undefined;
-        this.boundarySpan = this.maximumBoundary - this.minimumBoundary;
+        this._minimumBoundary = minimum >= 0 ? minimum : undefined;
+        this._maximumBoundary = maximum >= 0 ? maximum : undefined;
     },
 
     /**
@@ -691,6 +690,21 @@
     formatTime: function(value)
     {
         return Number.secondsToString(value);
+    },
+
+    maximumBoundary: function()
+    {
+        return this._maximumBoundary;
+    },
+
+    minimumBoundary: function()
+    {
+        return this._minimumBoundary;
+    },
+
+    boundarySpan: function()
+    {
+        return this._maximumBoundary - this._minimumBoundary;
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (126431 => 126432)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-08-23 15:42:33 UTC (rev 126431)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-08-23 15:46:13 UTC (rev 126432)
@@ -415,7 +415,7 @@
 
     _shouldShowFrames: function()
     {
-        return this._frameMode && this._presentationModel.frames().length > 0 && this.calculator.boundarySpan < 1.0;
+        return this._frameMode && this._presentationModel.frames().length > 0 && this.calculator.boundarySpan() < 1.0;
     },
 
     _updateFrames: function()
@@ -996,6 +996,7 @@
 /**
  * @constructor
  * @param {WebInspector.TimelineModel} model
+ * @implements {WebInspector.TimelineGrid.Calculator}
  */
 WebInspector.TimelineCalculator = function(model)
 {
@@ -1010,15 +1011,15 @@
      */
     computePosition: function(time)
     {
-        return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea + this.paddingLeft;
+        return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea + this.paddingLeft;
     },
 
     computeBarGraphPercentages: function(record)
     {
-        var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100;
-        var end = (record.startTime + record.selfTime - this.minimumBoundary) / this.boundarySpan * 100;
-        var endWithChildren = (record.lastChildEndTime - this.minimumBoundary) / this.boundarySpan * 100;
-        var cpuWidth = record.cpuTime / this.boundarySpan * 100;
+        var start = (record.startTime - this._minimumBoundary) / this.boundarySpan() * 100;
+        var end = (record.startTime + record.selfTime - this._minimumBoundary) / this.boundarySpan() * 100;
+        var endWithChildren = (record.lastChildEndTime - this._minimumBoundary) / this.boundarySpan() * 100;
+        var cpuWidth = record.cpuTime / this.boundarySpan() * 100;
         return {start: start, end: end, endWithChildren: endWithChildren, cpuWidth: cpuWidth};
     },
 
@@ -1043,9 +1044,8 @@
 
     setWindow: function(minimumBoundary, maximumBoundary)
     {
-        this.minimumBoundary = minimumBoundary;
-        this.maximumBoundary = maximumBoundary;
-        this.boundarySpan = this.maximumBoundary - this.minimumBoundary;
+        this._minimumBoundary = minimumBoundary;
+        this._maximumBoundary = maximumBoundary;
     },
 
     /**
@@ -1060,7 +1060,22 @@
 
     formatTime: function(value)
     {
-        return Number.secondsToString(value + this.minimumBoundary - this._model.minimumRecordTime());
+        return Number.secondsToString(value + this._minimumBoundary - this._model.minimumRecordTime());
+    },
+
+    maximumBoundary: function()
+    {
+        return this._maximumBoundary;
+    },
+
+    minimumBoundary: function()
+    {
+        return this._minimumBoundary;
+    },
+
+    boundarySpan: function()
+    {
+        return this._maximumBoundary - this._minimumBoundary;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to