Title: [229195] trunk/Source
Revision
229195
Author
[email protected]
Date
2018-03-02 23:58:55 -0800 (Fri, 02 Mar 2018)

Log Message

[WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
https://bugs.webkit.org/show_bug.cgi?id=183293

Reviewed by Alex Christensen.

Source/WebCore:

* platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
(WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):

Source/WebKit:

* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::scheduleUpdate):
(WebKit::CompositingRunLoop::compositionCompleted):
(WebKit::CompositingRunLoop::updateCompleted):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):

Source/WTF:

This patch mainly drops startRepeating(double) and startOneShot(double) interfaces.
Use startRepeating(Seconds) and startOneShot(Seconds) instead.

* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
* wtf/RunLoop.h:
(WTF::RunLoop::TimerBase::startRepeating):
(WTF::RunLoop::TimerBase::startOneShot):
(WTF::RunLoop::TimerBase::startInternal):
* wtf/RunLoopTimer.h:
* wtf/RunLoopTimerCF.cpp:
(WTF::RunLoopTimerBase::start):
* wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::runForDuration):
(WTF::RunLoop::TimerBase::start):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::start):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::start):
* wtf/win/MemoryPressureHandlerWin.cpp:
(WTF::MemoryPressureHandler::install):
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::start):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (229194 => 229195)


--- trunk/Source/WTF/ChangeLog	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/ChangeLog	2018-03-03 07:58:55 UTC (rev 229195)
@@ -1,3 +1,34 @@
+2018-03-02  Yusuke Suzuki  <[email protected]>
+
+        [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
+        https://bugs.webkit.org/show_bug.cgi?id=183293
+
+        Reviewed by Alex Christensen.
+
+        This patch mainly drops startRepeating(double) and startOneShot(double) interfaces.
+        Use startRepeating(Seconds) and startOneShot(Seconds) instead.
+
+        * wtf/MemoryPressureHandler.cpp:
+        (WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
+        * wtf/RunLoop.h:
+        (WTF::RunLoop::TimerBase::startRepeating):
+        (WTF::RunLoop::TimerBase::startOneShot):
+        (WTF::RunLoop::TimerBase::startInternal):
+        * wtf/RunLoopTimer.h:
+        * wtf/RunLoopTimerCF.cpp:
+        (WTF::RunLoopTimerBase::start):
+        * wtf/cf/RunLoopCF.cpp:
+        (WTF::RunLoop::runForDuration):
+        (WTF::RunLoop::TimerBase::start):
+        * wtf/generic/RunLoopGeneric.cpp:
+        (WTF::RunLoop::TimerBase::start):
+        * wtf/glib/RunLoopGLib.cpp:
+        (WTF::RunLoop::TimerBase::start):
+        * wtf/win/MemoryPressureHandlerWin.cpp:
+        (WTF::MemoryPressureHandler::install):
+        * wtf/win/RunLoopWin.cpp:
+        (WTF::RunLoop::TimerBase::start):
+
 2018-03-02  Christopher Reid  <[email protected]>
 
         Build fix after r229174

Modified: trunk/Source/WTF/wtf/MemoryPressureHandler.cpp (229194 => 229195)


--- trunk/Source/WTF/wtf/MemoryPressureHandler.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/MemoryPressureHandler.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -66,7 +66,7 @@
 
     if (use) {
         m_measurementTimer = std::make_unique<RunLoop::Timer<MemoryPressureHandler>>(RunLoop::main(), this, &MemoryPressureHandler::measurementTimerFired);
-        m_measurementTimer->startRepeating(30);
+        m_measurementTimer->startRepeating(30_s);
     } else
         m_measurementTimer = nullptr;
 }

Modified: trunk/Source/WTF/wtf/RunLoop.h (229194 => 229195)


--- trunk/Source/WTF/wtf/RunLoop.h	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/RunLoop.h	2018-03-03 07:58:55 UTC (rev 229195)
@@ -62,7 +62,7 @@
     WTF_EXPORT_PRIVATE void wakeUp();
 
 #if USE(COCOA_EVENT_LOOP)
-    WTF_EXPORT_PRIVATE void runForDuration(double duration);
+    WTF_EXPORT_PRIVATE void runForDuration(Seconds duration);
 #endif
 
 #if USE(GLIB_EVENT_LOOP)
@@ -84,10 +84,8 @@
         WTF_EXPORT_PRIVATE explicit TimerBase(RunLoop&);
         WTF_EXPORT_PRIVATE virtual ~TimerBase();
 
-        void startRepeating(double repeatInterval) { startInternal(repeatInterval, true); }
-        void startRepeating(Seconds repeatInterval) { startRepeating(repeatInterval.value()); }
-        void startOneShot(double interval) { startInternal(interval, false); }
-        void startOneShot(Seconds interval) { startOneShot(interval.value()); }
+        void startRepeating(Seconds repeatInterval) { startInternal(repeatInterval, true); }
+        void startOneShot(Seconds interval) { startInternal(interval, false); }
 
         WTF_EXPORT_PRIVATE void stop();
         WTF_EXPORT_PRIVATE bool isActive() const;
@@ -101,12 +99,12 @@
 #endif
 
     private:
-        void startInternal(double nextFireInterval, bool repeat)
+        void startInternal(Seconds nextFireInterval, bool repeat)
         {
-            start(std::max(nextFireInterval, 0.0), repeat);
+            start(std::max(nextFireInterval, 0_s), repeat);
         }
 
-        WTF_EXPORT_PRIVATE void start(double nextFireInterval, bool repeat);
+        WTF_EXPORT_PRIVATE void start(Seconds nextFireInterval, bool repeat);
 
         Ref<RunLoop> m_runLoop;
 

Modified: trunk/Source/WTF/wtf/RunLoopTimer.h (229194 => 229195)


--- trunk/Source/WTF/wtf/RunLoopTimer.h	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/RunLoopTimer.h	2018-03-03 07:58:55 UTC (rev 229195)
@@ -46,12 +46,10 @@
     WTF_EXPORT_PRIVATE void schedule(const SchedulePair*);
     WTF_EXPORT_PRIVATE void schedule(const SchedulePairHashSet&);
 
-    WTF_EXPORT_PRIVATE void start(double nextFireInterval, double repeatInterval);
+    WTF_EXPORT_PRIVATE void start(Seconds nextFireInterval, Seconds repeatInterval);
 
-    void startRepeating(double repeatInterval) { start(repeatInterval, repeatInterval); }
-    void startRepeating(Seconds repeatInterval) { start(repeatInterval.value(), repeatInterval.value()); }
-    void startOneShot(double interval) { start(interval, 0); }
-    void startOneShot(Seconds interval) { start(interval.value(), 0); }
+    void startRepeating(Seconds repeatInterval) { start(repeatInterval, repeatInterval); }
+    void startOneShot(Seconds interval) { start(interval, 0_s); }
 
     WTF_EXPORT_PRIVATE void stop();
     bool isActive() const;

Modified: trunk/Source/WTF/wtf/RunLoopTimerCF.cpp (229194 => 229195)


--- trunk/Source/WTF/wtf/RunLoopTimerCF.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/RunLoopTimerCF.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -52,12 +52,12 @@
     timer->fired();
 }
 
-void RunLoopTimerBase::start(double nextFireInterval, double repeatInterval)
+void RunLoopTimerBase::start(Seconds nextFireInterval, Seconds repeatInterval)
 {
     if (m_timer)
         CFRunLoopTimerInvalidate(m_timer.get());
     CFRunLoopTimerContext context = { 0, this, 0, 0, 0 };
-    m_timer = adoptCF(CFRunLoopTimerCreate(0, CFAbsoluteTimeGetCurrent() + nextFireInterval, repeatInterval, 0, 0, timerFired, &context));
+    m_timer = adoptCF(CFRunLoopTimerCreate(0, CFAbsoluteTimeGetCurrent() + nextFireInterval.seconds(), repeatInterval.seconds(), 0, 0, timerFired, &context));
 }
 
 void RunLoopTimerBase::schedule(const SchedulePair* schedulePair)

Modified: trunk/Source/WTF/wtf/cf/RunLoopCF.cpp (229194 => 229195)


--- trunk/Source/WTF/wtf/cf/RunLoopCF.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/cf/RunLoopCF.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -51,9 +51,9 @@
     CFRunLoopSourceInvalidate(m_runLoopSource.get());
 }
 
-void RunLoop::runForDuration(double duration)
+void RunLoop::runForDuration(Seconds duration)
 {
-    CFRunLoopRunInMode(kCFRunLoopDefaultMode, duration, true);
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, duration.seconds(), true);
 }
 
 void RunLoop::wakeUp()
@@ -94,14 +94,14 @@
     stop();
 }
 
-void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
+void RunLoop::TimerBase::start(Seconds nextFireInterval, bool repeat)
 {
     if (m_timer)
         stop();
     
     CFRunLoopTimerContext context = { 0, this, 0, 0, 0 };
-    CFTimeInterval repeatInterval = repeat ? nextFireInterval : 0;
-    m_timer = adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + nextFireInterval, repeatInterval, 0, 0, timerFired, &context));
+    Seconds repeatInterval = repeat ? nextFireInterval : 0_s;
+    m_timer = adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + nextFireInterval.seconds(), repeatInterval.seconds(), 0, 0, timerFired, &context));
     CFRunLoopAddTimer(m_runLoop->m_runLoop.get(), m_timer.get(), kCFRunLoopCommonModes);
 }
 

Modified: trunk/Source/WTF/wtf/generic/RunLoopGeneric.cpp (229194 => 229195)


--- trunk/Source/WTF/wtf/generic/RunLoopGeneric.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/generic/RunLoopGeneric.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -258,13 +258,13 @@
     stop(locker);
 }
 
-void RunLoop::TimerBase::start(double interval, bool repeating)
+void RunLoop::TimerBase::start(Seconds interval, bool repeating)
 {
     LockHolder locker(m_runLoop->m_loopLock);
     stop(locker);
     m_scheduledTask = ScheduledTask::create([this] {
         fired();
-    }, Seconds(interval), repeating);
+    }, interval, repeating);
     m_runLoop->scheduleAndWakeUp(locker, *m_scheduledTask);
 }
 

Modified: trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp (229194 => 229195)


--- trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -205,9 +205,9 @@
     g_source_set_ready_time(m_source.get(), targetTime);
 }
 
-void RunLoop::TimerBase::start(double fireInterval, bool repeat)
+void RunLoop::TimerBase::start(Seconds fireInterval, bool repeat)
 {
-    m_fireInterval = Seconds(fireInterval);
+    m_fireInterval = fireInterval;
     m_isRepeating = repeat;
     updateReadyTime();
 }

Modified: trunk/Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp (229194 => 229195)


--- trunk/Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/win/MemoryPressureHandlerWin.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -73,7 +73,7 @@
 void MemoryPressureHandler::install()
 {
     m_installed = true;
-    m_windowsMeasurementTimer.startRepeating(60.0);
+    m_windowsMeasurementTimer.startRepeating(60_s);
 }
 
 void MemoryPressureHandler::uninstall()

Modified: trunk/Source/WTF/wtf/win/RunLoopWin.cpp (229194 => 229195)


--- trunk/Source/WTF/wtf/win/RunLoopWin.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WTF/wtf/win/RunLoopWin.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -156,14 +156,14 @@
     stop();
 }
 
-void RunLoop::TimerBase::start(double nextFireInterval, bool repeat)
+void RunLoop::TimerBase::start(Seconds nextFireInterval, bool repeat)
 {
     LockHolder locker(m_runLoop->m_activeTimersLock);
     m_isRepeating = repeat;
     m_runLoop->m_activeTimers.set(m_ID, this);
-    m_interval = Seconds(nextFireInterval);
+    m_interval = nextFireInterval;
     m_nextFireDate = MonotonicTime::now() + m_interval;
-    ::SetTimer(m_runLoop->m_runLoopMessageWindow, m_ID, nextFireInterval * 1000, 0);
+    ::SetTimer(m_runLoop->m_runLoopMessageWindow, m_ID, nextFireInterval.millisecondsAs<unsigned>(), 0);
 }
 
 void RunLoop::TimerBase::stop()

Modified: trunk/Source/WebCore/ChangeLog (229194 => 229195)


--- trunk/Source/WebCore/ChangeLog	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WebCore/ChangeLog	2018-03-03 07:58:55 UTC (rev 229195)
@@ -1,3 +1,13 @@
+2018-03-02  Yusuke Suzuki  <[email protected]>
+
+        [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
+        https://bugs.webkit.org/show_bug.cgi?id=183293
+
+        Reviewed by Alex Christensen.
+
+        * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
+        (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
+
 2018-03-02  Dean Jackson  <[email protected]>
 
         Remove NP_GLContext since it is unsupported

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp (229194 => 229195)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -218,7 +218,7 @@
             if (prevBuffer->hasManagedTexture())
                 appendToUnusedBuffers(WTFMove(prevBuffer));
         };
-    m_compositorThreadUpdateTimer->startOneShot(0);
+    m_compositorThreadUpdateTimer->startOneShot(0_s);
 }
 
 bool TextureMapperPlatformLayerProxy::scheduleUpdateOnCompositorThread(Function<void()>&& updateFunction)

Modified: trunk/Source/WebKit/ChangeLog (229194 => 229195)


--- trunk/Source/WebKit/ChangeLog	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WebKit/ChangeLog	2018-03-03 07:58:55 UTC (rev 229195)
@@ -1,3 +1,17 @@
+2018-03-02  Yusuke Suzuki  <[email protected]>
+
+        [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
+        https://bugs.webkit.org/show_bug.cgi?id=183293
+
+        Reviewed by Alex Christensen.
+
+        * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
+        (WebKit::CompositingRunLoop::scheduleUpdate):
+        (WebKit::CompositingRunLoop::compositionCompleted):
+        (WebKit::CompositingRunLoop::updateCompleted):
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
+        (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
+
 2018-03-02  Don Olmstead  <[email protected]>
 
         Share common WebError implementation

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp (229194 => 229195)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -161,7 +161,7 @@
     switch (m_state.update) {
     case UpdateState::Idle:
         m_state.update = UpdateState::Scheduled;
-        m_updateTimer.startOneShot(0);
+        m_updateTimer.startOneShot(0_s);
         return;
     case UpdateState::Scheduled:
         return;
@@ -204,7 +204,7 @@
         if (m_state.pendingUpdate) {
             m_state.pendingUpdate = false;
             m_state.update = UpdateState::Scheduled;
-            m_updateTimer.startOneShot(0);
+            m_updateTimer.startOneShot(0_s);
             return;
         }
 
@@ -236,7 +236,7 @@
         if (m_state.pendingUpdate) {
             m_state.pendingUpdate = false;
             m_state.update = UpdateState::Scheduled;
-            m_updateTimer.startOneShot(0);
+            m_updateTimer.startOneShot(0_s);
             return;
         }
 

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp (229194 => 229195)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp	2018-03-03 00:07:51 UTC (rev 229194)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp	2018-03-03 07:58:55 UTC (rev 229195)
@@ -76,7 +76,7 @@
 {
     if (!m_compositor)
         return;
-    m_displayRefreshTimer.startOneShot(0);
+    m_displayRefreshTimer.startOneShot(0_s);
 }
 
 void ThreadedDisplayRefreshMonitor::invalidate()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to