[Chromium] Avoid aliasing global symbol monotonicallyIncreasingTime().
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2012 19:54:00 +0000 (19:54 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2012 19:54:00 +0000 (19:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=94233

Patch by David Reveman <reveman@chromium.org> on 2012-08-16
Reviewed by James Robinson.

Source/WebCore:

Rename virtual function CCDelayBasedTimeSource::monotonicallyIncreasingTime()
that exist for testing purposes to CCDelayBasedTimeSource::monotonicTimeNow().

No new tests.

* platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp:
(WebCore::CCDelayBasedTimeSource::setActive):
(WebCore::CCDelayBasedTimeSource::onTimerFired):
(WebCore::CCDelayBasedTimeSource::monotonicTimeNow):
* platform/graphics/chromium/cc/CCDelayBasedTimeSource.h:

Source/WebKit/chromium:

* tests/CCDelayBasedTimeSourceTest.cpp:
(WebKitTests::TEST):
* tests/CCFrameRateControllerTest.cpp:
(WebKitTests::TEST):
* tests/CCSchedulerTestCommon.h:
(WebKitTests::FakeCCDelayBasedTimeSource::setMonotonicTimeNow):
(WebKitTests::FakeCCDelayBasedTimeSource::FakeCCDelayBasedTimeSource):
(FakeCCDelayBasedTimeSource):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp
Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCDelayBasedTimeSourceTest.cpp
Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp
Source/WebKit/chromium/tests/CCSchedulerTestCommon.h

index 65718e0..66ce9f8 100644 (file)
@@ -1,5 +1,23 @@
 2012-08-16  David Reveman  <reveman@chromium.org>
 
+        [Chromium] Avoid aliasing global symbol monotonicallyIncreasingTime().
+        https://bugs.webkit.org/show_bug.cgi?id=94233
+
+        Reviewed by James Robinson.
+
+        Rename virtual function CCDelayBasedTimeSource::monotonicallyIncreasingTime()
+        that exist for testing purposes to CCDelayBasedTimeSource::monotonicTimeNow().
+
+        No new tests.
+
+        * platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp:
+        (WebCore::CCDelayBasedTimeSource::setActive):
+        (WebCore::CCDelayBasedTimeSource::onTimerFired):
+        (WebCore::CCDelayBasedTimeSource::monotonicTimeNow):
+        * platform/graphics/chromium/cc/CCDelayBasedTimeSource.h:
+
+2012-08-16  David Reveman  <reveman@chromium.org>
+
         [Chromium] Schedule texture uploads based on hard-coded timer and vsync.
         https://bugs.webkit.org/show_bug.cgi?id=84281
 
index 3f0d7c4..bf50994 100644 (file)
@@ -88,7 +88,7 @@ void CCDelayBasedTimeSource::setActive(bool active)
 
     m_state = STATE_ACTIVE;
 
-    double now = monotonicallyIncreasingTime();
+    double now = monotonicTimeNow();
     postNextTickTask(now);
 }
 
@@ -106,7 +106,7 @@ void CCDelayBasedTimeSource::onTimerFired()
 {
     ASSERT(m_state != STATE_INACTIVE);
 
-    double now = monotonicallyIncreasingTime();
+    double now = monotonicTimeNow();
     m_lastTickTime = now;
 
     if (m_state == STATE_STARTING) {
@@ -157,9 +157,9 @@ void CCDelayBasedTimeSource::setTimebaseAndInterval(double timebase, double inte
     }
 }
 
-double CCDelayBasedTimeSource::monotonicallyIncreasingTime() const
+double CCDelayBasedTimeSource::monotonicTimeNow() const
 {
-    return WTF::monotonicallyIncreasingTime();
+    return monotonicallyIncreasingTime();
 }
 
 // This code tries to achieve an average tick rate as close to m_intervalMs as possible.
index 61f637a..bf46378 100644 (file)
@@ -59,7 +59,7 @@ public:
     virtual void onTimerFired() OVERRIDE;
 
     // Virtual for testing.
-    virtual double monotonicallyIncreasingTime() const;
+    virtual double monotonicTimeNow() const;
 
 protected:
     CCDelayBasedTimeSource(double interval, CCThread*);
index 6f9ee11..223826e 100644 (file)
@@ -1,5 +1,21 @@
 2012-08-16  David Reveman  <reveman@chromium.org>
 
+        [Chromium] Avoid aliasing global symbol monotonicallyIncreasingTime().
+        https://bugs.webkit.org/show_bug.cgi?id=94233
+
+        Reviewed by James Robinson.
+
+        * tests/CCDelayBasedTimeSourceTest.cpp:
+        (WebKitTests::TEST):
+        * tests/CCFrameRateControllerTest.cpp:
+        (WebKitTests::TEST):
+        * tests/CCSchedulerTestCommon.h:
+        (WebKitTests::FakeCCDelayBasedTimeSource::setMonotonicTimeNow):
+        (WebKitTests::FakeCCDelayBasedTimeSource::FakeCCDelayBasedTimeSource):
+        (FakeCCDelayBasedTimeSource):
+
+2012-08-16  David Reveman  <reveman@chromium.org>
+
         [Chromium] Schedule texture uploads based on hard-coded timer and vsync.
         https://bugs.webkit.org/show_bug.cgi?id=84281
 
index 08b5d82..930439f 100644 (file)
@@ -44,12 +44,12 @@ TEST(CCDelayBasedTimeSourceTest, TaskPostedAndTickCalled)
     RefPtr<FakeCCDelayBasedTimeSource> timer = FakeCCDelayBasedTimeSource::create(1.0 / 60.0, &thread);
     timer->setClient(&client);
 
-    timer->setMonotonicallyIncreasingTime(0);
+    timer->setMonotonicTimeNow(0);
     timer->setActive(true);
     EXPECT_TRUE(timer->active());
     EXPECT_TRUE(thread.hasPendingTask());
 
-    timer->setMonotonicallyIncreasingTime(0.016);
+    timer->setMonotonicTimeNow(0.016);
     thread.runPendingTask();
     EXPECT_TRUE(timer->active());
     EXPECT_TRUE(client.tickCalled());
@@ -109,7 +109,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyOnRequestedTime)
 
     EXPECT_EQ(16, thread.pendingDelayMs());
 
-    timer->setMonotonicallyIncreasingTime(interval);
+    timer->setMonotonicTimeNow(interval);
     thread.runPendingTask();
 
     EXPECT_EQ(16, thread.pendingDelayMs());
@@ -130,7 +130,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterRequestedTime)
 
     EXPECT_EQ(16, thread.pendingDelayMs());
 
-    timer->setMonotonicallyIncreasingTime(interval + 0.0000001);
+    timer->setMonotonicTimeNow(interval + 0.0000001);
     thread.runPendingTask();
 
     EXPECT_EQ(16, thread.pendingDelayMs());
@@ -151,7 +151,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenExactlyTwiceAfterRequestedTime)
 
     EXPECT_EQ(16, thread.pendingDelayMs());
 
-    timer->setMonotonicallyIncreasingTime(2*interval);
+    timer->setMonotonicTimeNow(2*interval);
     thread.runPendingTask();
 
     EXPECT_EQ(16, thread.pendingDelayMs());
@@ -172,7 +172,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenSlightlyAfterTwiceRequestedTime)
 
     EXPECT_EQ(16, thread.pendingDelayMs());
 
-    timer->setMonotonicallyIncreasingTime(2*interval + 0.0000001);
+    timer->setMonotonicTimeNow(2*interval + 0.0000001);
     thread.runPendingTask();
 
     EXPECT_EQ(16, thread.pendingDelayMs());
@@ -193,7 +193,7 @@ TEST(CCDelayBasedTimeSource, NextDelaySaneWhenHalfAfterRequestedTime)
 
     EXPECT_EQ(16, thread.pendingDelayMs());
 
-    timer->setMonotonicallyIncreasingTime(interval + interval * 0.5);
+    timer->setMonotonicTimeNow(interval + interval * 0.5);
     thread.runPendingTask();
 
     EXPECT_EQ(8, thread.pendingDelayMs());
@@ -216,7 +216,7 @@ TEST(CCDelayBasedTimeSource, SaneHandlingOfJitteryTimebase)
 
     // Jitter timebase ~1ms late
     timer->setTimebaseAndInterval(interval + 0.001, interval);
-    timer->setMonotonicallyIncreasingTime(interval);
+    timer->setMonotonicTimeNow(interval);
     thread.runPendingTask();
 
     // Without double tick prevention, pendingDelayMs would be 1.
@@ -224,7 +224,7 @@ TEST(CCDelayBasedTimeSource, SaneHandlingOfJitteryTimebase)
 
     // Jitter timebase ~1ms early
     timer->setTimebaseAndInterval(interval * 2 - 0.001, interval);
-    timer->setMonotonicallyIncreasingTime(interval * 2);
+    timer->setMonotonicTimeNow(interval * 2);
     thread.runPendingTask();
 
     EXPECT_EQ(15, thread.pendingDelayMs());
@@ -244,7 +244,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantTimebaseChangesImmediately)
     EXPECT_EQ(16, thread.pendingDelayMs());
 
     // Tick, then shift timebase by +7ms.
-    timer->setMonotonicallyIncreasingTime(interval);
+    timer->setMonotonicTimeNow(interval);
     thread.runPendingTask();
 
     EXPECT_EQ(16, thread.pendingDelayMs());
@@ -258,7 +258,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantTimebaseChangesImmediately)
     EXPECT_EQ(7, thread.pendingDelayMs());
 
     // Tick, then shift timebase by -7ms.
-    timer->setMonotonicallyIncreasingTime(interval + 0.0070001);
+    timer->setMonotonicTimeNow(interval + 0.0070001);
     thread.runPendingTask();
 
     EXPECT_EQ(16, thread.pendingDelayMs());
@@ -286,7 +286,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantIntervalChangesImmediately)
     EXPECT_EQ(16, thread.pendingDelayMs());
 
     // Tick, then double the interval.
-    timer->setMonotonicallyIncreasingTime(interval);
+    timer->setMonotonicTimeNow(interval);
     thread.runPendingTask();
 
     EXPECT_EQ(16, thread.pendingDelayMs());
@@ -300,7 +300,7 @@ TEST(CCDelayBasedTimeSource, HanldlesSignificantIntervalChangesImmediately)
     EXPECT_EQ(33, thread.pendingDelayMs());
 
     // Tick, then halve the interval.
-    timer->setMonotonicallyIncreasingTime(interval * 3);
+    timer->setMonotonicTimeNow(interval * 3);
     thread.runPendingTask();
 
     EXPECT_EQ(33, thread.pendingDelayMs());
@@ -332,8 +332,8 @@ TEST(CCDelayBasedTimeSourceTest, AchievesTargetRateWithNoNoise)
         totalFrameTime += delayMs / 1000.0;
 
         // Run the callback exactly when asked
-        double now = timer->monotonicallyIncreasingTime() + delayMs / 1000.0;
-        timer->setMonotonicallyIncreasingTime(now);
+        double now = timer->monotonicTimeNow() + delayMs / 1000.0;
+        timer->setMonotonicTimeNow(now);
         thread.runPendingTask();
     }
     double averageInterval = totalFrameTime / static_cast<double>(numIterations);
@@ -361,7 +361,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime)
 
     // Should run the activate task, and pick up a new timebase.
     timer->setActive(true);
-    timer->setMonotonicallyIncreasingTime(0);
+    timer->setMonotonicTimeNow(0);
     thread.runPendingTask();
 
     // Stop the timer
@@ -372,7 +372,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateBeforeNextTickTime)
 
     // Start the timer again, but before the next tick time the timer previously
     // planned on using. That same tick time should still be targeted.
-    timer->setMonotonicallyIncreasingTime(0.004);
+    timer->setMonotonicTimeNow(0.004);
     timer->setActive(true);
     EXPECT_EQ(12, thread.pendingDelayMs());
 }
@@ -386,7 +386,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime)
 
     // Should run the activate task, and pick up a new timebase.
     timer->setActive(true);
-    timer->setMonotonicallyIncreasingTime(0);
+    timer->setMonotonicTimeNow(0);
     thread.runPendingTask();
 
     // Stop the timer
@@ -397,7 +397,7 @@ TEST(CCDelayBasedTimeSource, TestDeactivateAndReactivateAfterNextTickTime)
 
     // Start the timer again, but before the next tick time the timer previously
     // planned on using. That same tick time should still be targeted.
-    timer->setMonotonicallyIncreasingTime(0.02);
+    timer->setMonotonicTimeNow(0.02);
     timer->setActive(true);
     EXPECT_EQ(13, thread.pendingDelayMs());
 }
index 20f2374..ab365a5 100644 (file)
@@ -63,7 +63,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck)
 
     // Trigger one frame, make sure the vsync callback is called
     elapsed += thread.pendingDelayMs() / 1000.0;
-    timeSource->setMonotonicallyIncreasingTime(elapsed);
+    timeSource->setMonotonicTimeNow(elapsed);
     thread.runPendingTask();
     EXPECT_TRUE(client.vsyncTicked());
     client.reset();
@@ -72,13 +72,13 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck)
     controller.didBeginFrame();
 
     // Tell the controller the frame ended 5ms later
-    timeSource->setMonotonicallyIncreasingTime(timeSource->monotonicallyIncreasingTime() + 0.005);
+    timeSource->setMonotonicTimeNow(timeSource->monotonicTimeNow() + 0.005);
     controller.didFinishFrame();
 
     // Trigger another frame, make sure vsync runs again
     elapsed += thread.pendingDelayMs() / 1000.0;
-    EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward.
-    timeSource->setMonotonicallyIncreasingTime(elapsed);
+    EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward.
+    timeSource->setMonotonicTimeNow(elapsed);
     thread.runPendingTask();
     EXPECT_TRUE(client.vsyncTicked());
 }
@@ -98,7 +98,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight)
 
     // Trigger one frame, make sure the vsync callback is called
     elapsed += thread.pendingDelayMs() / 1000.0;
-    timeSource->setMonotonicallyIncreasingTime(elapsed);
+    timeSource->setMonotonicTimeNow(elapsed);
     thread.runPendingTask();
     EXPECT_TRUE(client.vsyncTicked());
     client.reset();
@@ -108,8 +108,8 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight)
 
     // Trigger another frame, make sure vsync callback runs again
     elapsed += thread.pendingDelayMs() / 1000.0;
-    EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward.
-    timeSource->setMonotonicallyIncreasingTime(elapsed);
+    EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward.
+    timeSource->setMonotonicTimeNow(elapsed);
     thread.runPendingTask();
     EXPECT_TRUE(client.vsyncTicked());
     client.reset();
@@ -119,13 +119,13 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight)
 
     // Trigger another frame. Since two frames are pending, we should not draw.
     elapsed += thread.pendingDelayMs() / 1000.0;
-    EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward.
-    timeSource->setMonotonicallyIncreasingTime(elapsed);
+    EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward.
+    timeSource->setMonotonicTimeNow(elapsed);
     thread.runPendingTask();
     EXPECT_FALSE(client.vsyncTicked());
 
     // Tell the controller the first frame ended 5ms later
-    timeSource->setMonotonicallyIncreasingTime(timeSource->monotonicallyIncreasingTime() + 0.005);
+    timeSource->setMonotonicTimeNow(timeSource->monotonicTimeNow() + 0.005);
     controller.didFinishFrame();
 
     // Tick should not have been called
@@ -133,8 +133,8 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight)
 
     // Trigger yet another frame. Since one frames is pending, another vsync callback should run.
     elapsed += thread.pendingDelayMs() / 1000.0;
-    EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward.
-    timeSource->setMonotonicallyIncreasingTime(elapsed);
+    EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward.
+    timeSource->setMonotonicTimeNow(elapsed);
     thread.runPendingTask();
     EXPECT_TRUE(client.vsyncTicked());
 }
index d9dd5e5..2d2da36 100644 (file)
@@ -130,15 +130,15 @@ public:
         return adoptRef(new FakeCCDelayBasedTimeSource(interval, thread));
     }
 
-    void setMonotonicallyIncreasingTime(double time) { m_monotonicallyIncreasingTime = time; }
-    virtual double monotonicallyIncreasingTime() const { return m_monotonicallyIncreasingTime; }
+    void setMonotonicTimeNow(double time) { m_monotonicTimeNow = time; }
+    virtual double monotonicTimeNow() const OVERRIDE { return m_monotonicTimeNow; }
 
 protected:
     FakeCCDelayBasedTimeSource(double interval, WebCore::CCThread* thread)
         : CCDelayBasedTimeSource(interval, thread)
-        , m_monotonicallyIncreasingTime(0) { }
+        , m_monotonicTimeNow(0) { }
 
-    double m_monotonicallyIncreasingTime;
+    double m_monotonicTimeNow;
 };
 
 class FakeCCFrameRateController : public WebCore::CCFrameRateController {