Commit log viewer repaints too frequently after r198499
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Mar 2016 02:58:19 +0000 (02:58 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Mar 2016 02:58:19 +0000 (02:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155732

Reviewed by Joseph Pecoraro.

The bug was caused by InteractiveTimeSeriesChart invoking onchange callback whenever mouse moved even
if the current point didn't change. Fixed the bug by avoiding the work if the indicator hadn't changed
and avoiding work in the commit log viewer when the requested repository and the revision range were
the same as those of the last request.

* public/v3/components/commit-log-viewer.js:
(CommitLogViewer):
(CommitLogViewer.prototype.currentRepository): Exit early when repository and the revision range are
identical to the one we already have to avoid repaints and issuing multiple network requests.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype._mouseMove): Don't invoke _notifyIndicatorChanged if the current
indicator hadn't changed.
* public/v3/pages/chart-pane.js:
(ChartPane.prototype._indicatorDidChange): Fixed the bug that unlocking the indicator wouldn't update
the URL. We need to check whether the lock state had changed. The old condition was also redundant
since _mainChartIndicatorWasLocked is always identically equal to isLocked per the prior assignment.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@198518 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/v3/components/commit-log-viewer.js
Websites/perf.webkit.org/public/v3/components/interactive-time-series-chart.js
Websites/perf.webkit.org/public/v3/pages/chart-pane.js

index 46baeb82d00991bce642d39b17238b982612f1a7..0681535bd0297c3c4f5c21e228abf60a35971e99 100644 (file)
@@ -1,3 +1,27 @@
+2016-03-21  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Commit log viewer repaints too frequently after r198499
+        https://bugs.webkit.org/show_bug.cgi?id=155732
+
+        Reviewed by Joseph Pecoraro.
+
+        The bug was caused by InteractiveTimeSeriesChart invoking onchange callback whenever mouse moved even
+        if the current point didn't change. Fixed the bug by avoiding the work if the indicator hadn't changed
+        and avoiding work in the commit log viewer when the requested repository and the revision range were
+        the same as those of the last request.
+
+        * public/v3/components/commit-log-viewer.js:
+        (CommitLogViewer):
+        (CommitLogViewer.prototype.currentRepository): Exit early when repository and the revision range are
+        identical to the one we already have to avoid repaints and issuing multiple network requests.
+        * public/v3/components/interactive-time-series-chart.js:
+        (InteractiveTimeSeriesChart.prototype._mouseMove): Don't invoke _notifyIndicatorChanged if the current
+        indicator hadn't changed.
+        * public/v3/pages/chart-pane.js:
+        (ChartPane.prototype._indicatorDidChange): Fixed the bug that unlocking the indicator wouldn't update
+        the URL. We need to check whether the lock state had changed. The old condition was also redundant
+        since _mainChartIndicatorWasLocked is always identically equal to isLocked per the prior assignment.
+
 2016-03-21  Ryosuke Niwa  <rniwa@webkit.org>
 
         Fix A/B testing after r198503.
index 47ea457cedb6014ace6b479419f2cfb90da3b875..0e9de0509d90a52c98ba06344b9e5fd77c873c44 100644 (file)
@@ -7,13 +7,21 @@ class CommitLogViewer extends ComponentBase {
         this._repository = null;
         this._fetchingPromise = null;
         this._commits = null;
+        this._from = null;
+        this._to = null;
     }
 
     currentRepository() { return this._repository; }
 
     view(repository, from, to)
     {
+        if (this._repository == repository && this._from == from && this._to == to)
+            return Promise.resolve(null);
+
         this._commits = null;
+        this._repository = repository;
+        this._from = from;
+        this._to = to;
 
         if (!repository) {
             this._fetchingPromise = null;
@@ -21,8 +29,6 @@ class CommitLogViewer extends ComponentBase {
             return Promise.resolve(null);
         }
 
-        this._repository = repository;
-
         if (!to) {
             this._fetchingPromise = null;
             this.render();
index 03103bdcd04d7de1ad2cb005ce4fd4e286e20315..7c06f7fb886dc689219a0254a8a088a42a1915b2 100644 (file)
@@ -175,13 +175,21 @@ class InteractiveTimeSeriesChart extends TimeSeriesChart {
 
         var oldIndicatorID = this._indicatorID;
 
-        this._currentAnnotation = this._findAnnotation(cursorLocation);
+        var newAnnotation = this._findAnnotation(cursorLocation);
+        var newIndicatorID = null;
         if (this._currentAnnotation)
-            this._indicatorID = null;
+            newIndicatorID = null;
         else
-            this._indicatorID = this._findClosestPoint(cursorLocation);
+            newIndicatorID = this._findClosestPoint(cursorLocation);
 
         this._forceRender = true;
+
+        if (this._currentAnnotation == newAnnotation && this._indicatorID == newIndicatorID)
+            return;
+
+        this._currentAnnotation = newAnnotation;
+        this._indicatorID = newIndicatorID;
+
         this._notifyIndicatorChanged();
     }
 
index a47cfa25356c492f9fe1f956c5c828429b9a1d12..ba043f03cfb52546664ec73bb521474527f0aa32 100644 (file)
@@ -82,8 +82,8 @@ class ChartPane extends ChartPaneBase {
 
     _indicatorDidChange(indicatorID, isLocked)
     {
+        this._chartsPage.mainChartIndicatorDidChange(this, isLocked != this._mainChartIndicatorWasLocked);
         this._mainChartIndicatorWasLocked = isLocked;
-        this._chartsPage.mainChartIndicatorDidChange(this, isLocked || this._mainChartIndicatorWasLocked);
         super._indicatorDidChange(indicatorID, isLocked);
     }