Title: [126431] trunk/Source
Revision
126431
Author
[email protected]
Date
2012-08-23 08:42:33 -0700 (Thu, 23 Aug 2012)

Log Message

[Chromium] Unnecessary delay when starting to update resources with an inactive vsync timer.
https://bugs.webkit.org/show_bug.cgi?id=94719

Patch by David Reveman <[email protected]> on 2012-08-23
Reviewed by James Robinson.

Source/WebCore:

Replace nextTickTime() with nextTickTimeIfActivated() and return
appropriate value when timer is inactive.

No new tests.

* platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp:
(WebCore::CCDelayBasedTimeSource::nextTickTimeIfActivated):
(WebCore::CCDelayBasedTimeSource::nextTickTarget):
(WebCore):
(WebCore::CCDelayBasedTimeSource::postNextTickTask):
* platform/graphics/chromium/cc/CCDelayBasedTimeSource.h:
* platform/graphics/chromium/cc/CCFrameRateController.cpp:
(WebCore::CCFrameRateController::nextTickTimeIfActivated):
* platform/graphics/chromium/cc/CCFrameRateController.h:
(CCFrameRateController):
* platform/graphics/chromium/cc/CCScheduler.cpp:
(WebCore::CCScheduler::processScheduledActions):
* platform/graphics/chromium/cc/CCTimeSource.h:
(CCTimeSource):

Source/WebKit/chromium:

* tests/CCSchedulerTestCommon.h:

Modified Paths

Diff

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


--- trunk/Source/WebCore/ChangeLog	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebCore/ChangeLog	2012-08-23 15:42:33 UTC (rev 126431)
@@ -1,3 +1,30 @@
+2012-08-23  David Reveman  <[email protected]>
+
+        [Chromium] Unnecessary delay when starting to update resources with an inactive vsync timer.
+        https://bugs.webkit.org/show_bug.cgi?id=94719
+
+        Reviewed by James Robinson.
+
+        Replace nextTickTime() with nextTickTimeIfActivated() and return
+        appropriate value when timer is inactive.
+
+        No new tests.
+
+        * platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp:
+        (WebCore::CCDelayBasedTimeSource::nextTickTimeIfActivated):
+        (WebCore::CCDelayBasedTimeSource::nextTickTarget):
+        (WebCore):
+        (WebCore::CCDelayBasedTimeSource::postNextTickTask):
+        * platform/graphics/chromium/cc/CCDelayBasedTimeSource.h:
+        * platform/graphics/chromium/cc/CCFrameRateController.cpp:
+        (WebCore::CCFrameRateController::nextTickTimeIfActivated):
+        * platform/graphics/chromium/cc/CCFrameRateController.h:
+        (CCFrameRateController):
+        * platform/graphics/chromium/cc/CCScheduler.cpp:
+        (WebCore::CCScheduler::processScheduledActions):
+        * platform/graphics/chromium/cc/CCTimeSource.h:
+        (CCTimeSource):
+
 2012-08-23  Pavel Feldman  <[email protected]>
 
         Web Inspector: make treeoutline.js compiler-friendly

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp (126430 => 126431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp	2012-08-23 15:42:33 UTC (rev 126431)
@@ -97,9 +97,9 @@
     return m_lastTickTime;
 }
 
-double CCDelayBasedTimeSource::nextTickTime()
+double CCDelayBasedTimeSource::nextTickTimeIfActivated()
 {
-    return active() ? m_currentParameters.tickTarget : 0.0;
+    return active() ? m_currentParameters.tickTarget : nextTickTarget(monotonicTimeNow());
 }
 
 void CCDelayBasedTimeSource::onTimerFired()
@@ -207,7 +207,7 @@
 //      now=37   tickTarget=16.667  newTarget=50.000  --> tick(), postDelayedTask(floor(50.000-37)) --> postDelayedTask(13)
 //
 // Note, that in the above discussion, times are expressed in milliseconds, but in the code, seconds are used.
-void CCDelayBasedTimeSource::postNextTickTask(double now)
+double CCDelayBasedTimeSource::nextTickTarget(double now)
 {
     double newInterval = m_nextParameters.interval;
     double intervalsElapsed = floor((now - m_nextParameters.tickTarget) / newInterval);
@@ -221,9 +221,16 @@
     if (newTickTarget - m_lastTickTime <= newInterval * doubleTickThreshold)
         newTickTarget += newInterval;
 
+    return newTickTarget;
+}
+
+void CCDelayBasedTimeSource::postNextTickTask(double now)
+{
+    double newTickTarget = nextTickTarget(now);
+
     // Post another task *before* the tick and update state
     double delay = newTickTarget - now;
-    ASSERT(delay <= newInterval * (1.0 + doubleTickThreshold));
+    ASSERT(delay <= m_nextParameters.interval * (1.0 + doubleTickThreshold));
     m_timer.startOneShot(delay);
 
     m_nextParameters.tickTarget = newTickTarget;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h (126430 => 126431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h	2012-08-23 15:42:33 UTC (rev 126431)
@@ -50,9 +50,8 @@
     virtual bool active() const OVERRIDE { return m_state != STATE_INACTIVE; }
 
     // Get the last and next tick times.
-    // If not active, nextTickTime will return 0.
     virtual double lastTickTime() OVERRIDE;
-    virtual double nextTickTime() OVERRIDE;
+    virtual double nextTickTimeIfActivated() OVERRIDE;
 
     // CCTimerClient implementation.
     virtual void onTimerFired() OVERRIDE;
@@ -62,6 +61,7 @@
 
 protected:
     CCDelayBasedTimeSource(double interval, CCThread*);
+    double nextTickTarget(double now);
     void postNextTickTask(double now);
 
     enum State {

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp (126430 => 126431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp	2012-08-23 15:42:33 UTC (rev 126431)
@@ -151,10 +151,10 @@
     m_numFramesPending = 0;
 }
 
-double CCFrameRateController::nextTickTime()
+double CCFrameRateController::nextTickTimeIfActivated()
 {
     if (m_isTimeSourceThrottling)
-        return m_timeSource->nextTickTime();
+        return m_timeSource->nextTickTimeIfActivated();
 
     return monotonicallyIncreasingTime();
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h (126430 => 126431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h	2012-08-23 15:42:33 UTC (rev 126431)
@@ -67,7 +67,7 @@
     void didFinishFrame();
     void didAbortAllPendingFrames();
     void setMaxFramesPending(int); // 0 for unlimited.
-    double nextTickTime();
+    double nextTickTimeIfActivated();
 
     void setTimebaseAndInterval(double timebase, double intervalSeconds);
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp (126430 => 126431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp	2012-08-23 15:42:33 UTC (rev 126431)
@@ -175,7 +175,7 @@
             break;
         case CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES:
             if (m_client->hasMoreResourceUpdates()) {
-                m_client->scheduledActionUpdateMoreResources(m_frameRateController->nextTickTime());
+                m_client->scheduledActionUpdateMoreResources(m_frameRateController->nextTickTimeIfActivated());
                 m_updateMoreResourcesPending = true;
             } else
                 m_stateMachine.beginUpdateMoreResourcesComplete(false);

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h (126430 => 126431)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h	2012-08-23 15:42:33 UTC (rev 126431)
@@ -52,7 +52,7 @@
     virtual bool active() const = 0;
     virtual void setTimebaseAndInterval(double timebase, double intervalSeconds) = 0;
     virtual double lastTickTime() = 0;
-    virtual double nextTickTime() = 0;
+    virtual double nextTickTimeIfActivated() = 0;
 };
 
 }

Modified: trunk/Source/WebKit/chromium/ChangeLog (126430 => 126431)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-23 15:42:33 UTC (rev 126431)
@@ -1,3 +1,12 @@
+2012-08-23  David Reveman  <[email protected]>
+
+        [Chromium] Unnecessary delay when starting to update resources with an inactive vsync timer.
+        https://bugs.webkit.org/show_bug.cgi?id=94719
+
+        Reviewed by James Robinson.
+
+        * tests/CCSchedulerTestCommon.h:
+
 2012-08-23  Peter Beverloo  <[email protected]>
 
         Unreviewed.  Rolled DEPS.

Modified: trunk/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h (126430 => 126431)


--- trunk/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h	2012-08-23 15:36:45 UTC (rev 126430)
+++ trunk/Source/WebKit/chromium/tests/CCSchedulerTestCommon.h	2012-08-23 15:42:33 UTC (rev 126431)
@@ -106,7 +106,7 @@
     virtual bool active() const OVERRIDE { return m_active; }
     virtual void setTimebaseAndInterval(double timebase, double interval) OVERRIDE { }
     virtual double lastTickTime() OVERRIDE { return 0; }
-    virtual double nextTickTime() OVERRIDE { return 0; }
+    virtual double nextTickTimeIfActivated() OVERRIDE { return 0; }
 
     void tick()
     {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to