Drop Timer::startRepeating() overload taking a double
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Apr 2017 23:42:02 +0000 (23:42 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Apr 2017 23:42:02 +0000 (23:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170656

Reviewed by Yusuke Suzuki.

Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.

Source/WebCore:

* Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
(WebCore::CanvasCaptureMediaStreamTrack::Source::startProducingData):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::updateAppearance):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::startProgressEventTimer):
(WebCore::HTMLMediaElement::scheduleTimeupdateEvent):
* html/HTMLMediaElement.h:
* html/MediaController.cpp:
(MediaController::MediaController):
(MediaController::scheduleTimeupdateEvent):
* html/MediaController.h:
* html/MediaElementSession.cpp:
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::showPaintRect):
* loader/ProgressTracker.cpp:
* page/AutoscrollController.cpp:
* page/Frame.cpp:
* page/PageOverlay.cpp:
(WebCore::PageOverlay::startFadeAnimation):
* page/SuspendableTimer.h:
* page/WheelEventTestTrigger.cpp:
(WebCore::WheelEventTestTrigger::setTestCallbackAndStartNotificationTimer):
* platform/Theme.h:
(WebCore::Theme::caretBlinkInterval):
* platform/Timer.h:
* platform/cocoa/ScrollController.mm:
(WebCore::ScrollController::startSnapRubberbandTimer):
(WebCore::ScrollController::startScrollSnapTimer):
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::scheduleCohortRemoval):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering):
* platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
(WebCore::MockRealtimeAudioSourceMac::reconfigure):
* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::startProducingData):
* platform/mock/MockRealtimeAudioSource.h:
(WebCore::MockRealtimeAudioSource::renderInterval):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::startProducingData):
(WebCore::MockRealtimeVideoSource::applyFrameRate):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::start):
(WebCore::RenderMarquee::updateMarqueeStyle):
* rendering/RenderTheme.h:
(WebCore::RenderTheme::caretBlinkInterval):
* rendering/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::caretBlinkInterval):
* rendering/RenderThemeGtk.h:
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent):
* xml/XMLHttpRequestProgressEventThrottle.h:

Source/WebKit/mac:

* Plugins/WebNetscapePluginView.mm:
(PluginTimer::start):

Source/WebKit/win:

* FullscreenVideoController.cpp:

Source/WebKit2:

* Shared/WebMemorySampler.cpp:
(WebKit::WebMemorySampler::initializeTimers):
* UIProcess/Cocoa/ViewGestureController.cpp:
* UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
* UIProcess/PerActivityStateCPUUsageSampler.cpp:
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::Timer::start):
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases):

Tools:

* TestWebKitAPI/Tests/WTF/RunLoop.cpp:
(TestWebKitAPI::TEST):

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

44 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/MediaController.cpp
Source/WebCore/html/MediaController.h
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/loader/ProgressTracker.cpp
Source/WebCore/page/AutoscrollController.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/PageOverlay.cpp
Source/WebCore/page/SuspendableTimer.h
Source/WebCore/page/WheelEventTestTrigger.cpp
Source/WebCore/platform/Theme.h
Source/WebCore/platform/Timer.h
Source/WebCore/platform/cocoa/ScrollController.mm
Source/WebCore/platform/graphics/ca/TileGrid.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/mediastream/mac/MockRealtimeAudioSourceMac.mm
Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp
Source/WebCore/platform/mock/MockRealtimeAudioSource.h
Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp
Source/WebCore/rendering/RenderMarquee.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeGtk.cpp
Source/WebCore/rendering/RenderThemeGtk.h
Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp
Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Plugins/WebNetscapePluginView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/FullscreenVideoController.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebMemorySampler.cpp
Source/WebKit2/UIProcess/Cocoa/ViewGestureController.cpp
Source/WebKit2/UIProcess/HighPerformanceGraphicsUsageSampler.cpp
Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp

index d327fc2..f6838ca 100644 (file)
@@ -1,3 +1,66 @@
+2017-04-09  Chris Dumez  <cdumez@apple.com>
+
+        Drop Timer::startRepeating() overload taking a double
+        https://bugs.webkit.org/show_bug.cgi?id=170656
+
+        Reviewed by Yusuke Suzuki.
+
+        Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.
+
+        * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
+        (WebCore::CanvasCaptureMediaStreamTrack::Source::startProducingData):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::updateAppearance):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::startProgressEventTimer):
+        (WebCore::HTMLMediaElement::scheduleTimeupdateEvent):
+        * html/HTMLMediaElement.h:
+        * html/MediaController.cpp:
+        (MediaController::MediaController):
+        (MediaController::scheduleTimeupdateEvent):
+        * html/MediaController.h:
+        * html/MediaElementSession.cpp:
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::showPaintRect):
+        * loader/ProgressTracker.cpp:
+        * page/AutoscrollController.cpp:
+        * page/Frame.cpp:
+        * page/PageOverlay.cpp:
+        (WebCore::PageOverlay::startFadeAnimation):
+        * page/SuspendableTimer.h:
+        * page/WheelEventTestTrigger.cpp:
+        (WebCore::WheelEventTestTrigger::setTestCallbackAndStartNotificationTimer):
+        * platform/Theme.h:
+        (WebCore::Theme::caretBlinkInterval):
+        * platform/Timer.h:
+        * platform/cocoa/ScrollController.mm:
+        (WebCore::ScrollController::startSnapRubberbandTimer):
+        (WebCore::ScrollController::startScrollSnapTimer):
+        * platform/graphics/ca/TileGrid.cpp:
+        (WebCore::TileGrid::scheduleCohortRemoval):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering):
+        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
+        (WebCore::MockRealtimeAudioSourceMac::reconfigure):
+        * platform/mock/MockRealtimeAudioSource.cpp:
+        (WebCore::MockRealtimeAudioSource::startProducingData):
+        * platform/mock/MockRealtimeAudioSource.h:
+        (WebCore::MockRealtimeAudioSource::renderInterval):
+        * platform/mock/MockRealtimeVideoSource.cpp:
+        (WebCore::MockRealtimeVideoSource::startProducingData):
+        (WebCore::MockRealtimeVideoSource::applyFrameRate):
+        * rendering/RenderMarquee.cpp:
+        (WebCore::RenderMarquee::start):
+        (WebCore::RenderMarquee::updateMarqueeStyle):
+        * rendering/RenderTheme.h:
+        (WebCore::RenderTheme::caretBlinkInterval):
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::caretBlinkInterval):
+        * rendering/RenderThemeGtk.h:
+        * xml/XMLHttpRequestProgressEventThrottle.cpp:
+        (WebCore::XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent):
+        * xml/XMLHttpRequestProgressEventThrottle.h:
+
 2017-04-09  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         generate-bindings-all.pl shouldn't use Perl threads
index 3009672..db4c404 100644 (file)
@@ -88,7 +88,7 @@ void CanvasCaptureMediaStreamTrack::Source::startProducingData()
         return;
 
     if (m_frameRequestRate.value())
-        m_requestFrameTimer.startRepeating(1. / m_frameRequestRate.value());
+        m_requestFrameTimer.startRepeating(1_s / m_frameRequestRate.value());
 }
 
 void CanvasCaptureMediaStreamTrack::Source::stopProducingData()
index 4f50648..986b35e 100644 (file)
@@ -2057,7 +2057,7 @@ void FrameSelection::updateAppearance()
     // Start blinking with a black caret. Be sure not to restart if we're
     // already blinking in the right location.
     if (shouldBlink && !m_caretBlinkTimer.isActive()) {
-        if (double blinkInterval = m_frame->page()->theme().caretBlinkInterval())
+        if (Seconds blinkInterval = m_frame->page()->theme().caretBlinkInterval())
             m_caretBlinkTimer.startRepeating(blinkInterval);
 
         if (!m_caretPaint) {
index fa032a0..4d60468 100644 (file)
@@ -2040,7 +2040,7 @@ void HTMLMediaElement::startProgressEventTimer()
 
     m_previousProgressTime = monotonicallyIncreasingTime();
     // 350ms is not magic, it is in the spec!
-    m_progressEventTimer.startRepeating(0.350);
+    m_progressEventTimer.startRepeating(350_ms);
 }
 
 void HTMLMediaElement::waitForSourceChange()
@@ -3521,7 +3521,7 @@ void HTMLMediaElement::scanTimerFired()
 
 // The spec says to fire periodic timeupdate events (those sent while playing) every
 // "15 to 250ms", we choose the slowest frequency
-static const double maxTimeupdateEventFrequency = 0.25;
+static const Seconds maxTimeupdateEventFrequency { 250_ms };
 
 void HTMLMediaElement::startPlaybackProgressTimer()
 {
@@ -3564,8 +3564,8 @@ void HTMLMediaElement::playbackProgressTimerFired()
 
 void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent)
 {
-    double now = monotonicallyIncreasingTime();
-    double timedelta = now - m_clockTimeAtLastUpdateEvent;
+    MonotonicTime now = MonotonicTime::now();
+    Seconds timedelta = now - m_clockTimeAtLastUpdateEvent;
 
     // throttle the periodic events
     if (periodicEvent && timedelta < maxTimeupdateEventFrequency)
index 716d286..7c0e52f 100644 (file)
@@ -887,7 +887,7 @@ private:
     double m_playbackStartedTime { 0 };
 
     // The last time a timeupdate event was sent (based on monotonic clock).
-    double m_clockTimeAtLastUpdateEvent { 0 };
+    MonotonicTime m_clockTimeAtLastUpdateEvent;
 
     // The last time a timeupdate event was sent in movie time.
     MediaTime m_lastTimeUpdateEventMovieTime;
index ea8a256..6e3465c 100644 (file)
@@ -58,7 +58,6 @@ MediaController::MediaController(ScriptExecutionContext& context)
     , m_clock(Clock::create())
     , m_scriptExecutionContext(context)
     , m_timeupdateTimer(*this, &MediaController::scheduleTimeupdateEvent)
-    , m_previousTimeupdateTime(0)
 {
 }
 
@@ -664,7 +663,7 @@ void MediaController::returnToRealtime()
 
 // The spec says to fire periodic timeupdate events (those sent while playing) every
 // "15 to 250ms", we choose the slowest frequency
-static const double maxTimeupdateEventFrequency = 0.25;
+static const Seconds maxTimeupdateEventFrequency { 250_ms };
 
 void MediaController::startTimeupdateTimer()
 {
@@ -676,8 +675,8 @@ void MediaController::startTimeupdateTimer()
 
 void MediaController::scheduleTimeupdateEvent()
 {
-    double now = monotonicallyIncreasingTime();
-    double timedelta = now - m_previousTimeupdateTime;
+    MonotonicTime now = MonotonicTime::now();
+    Seconds timedelta = now - m_previousTimeupdateTime;
 
     if (timedelta < maxTimeupdateEventFrequency)
         return;
index 178fa74..a919248 100644 (file)
@@ -145,7 +145,7 @@ private:
     std::unique_ptr<Clock> m_clock;
     ScriptExecutionContext& m_scriptExecutionContext;
     Timer m_timeupdateTimer;
-    double m_previousTimeupdateTime;
+    MonotonicTime m_previousTimeupdateTime;
     bool m_resetCurrentTimeInNextPlay { false };
 };
 
index 3b5ff78..1ac40dc 100644 (file)
@@ -57,7 +57,7 @@
 
 namespace WebCore {
 
-static const double elementMainContentCheckInterval = .250;
+static const Seconds elementMainContentCheckInterval { 250_ms };
 
 static bool isElementRectMostlyInMainFrame(const HTMLMediaElement&);
 static bool isElementLargeEnoughForMainContent(const HTMLMediaElement&, MediaSessionMainContentPurpose);
index 5f178a7..ea6e784 100644 (file)
@@ -513,8 +513,8 @@ void InspectorOverlay::showPaintRect(const FloatRect& rect)
     m_paintRects.append(TimeRectPair(removeTime, rootRect));
 
     if (!m_paintRectUpdateTimer.isActive()) {
-        const double paintRectsUpdateIntervalSeconds = 0.032;
-        m_paintRectUpdateTimer.startRepeating(paintRectsUpdateIntervalSeconds);
+        const Seconds paintRectsUpdateInterval { 32_ms };
+        m_paintRectUpdateTimer.startRepeating(paintRectsUpdateInterval);
     }
 
     drawPaintRects();
index fe0c722..b196a59 100644 (file)
@@ -52,7 +52,7 @@ static const double finalProgressValue = 0.9; // 1.0 - initialProgressValue
 static const int progressItemDefaultEstimatedLength = 1024 * 16;
 
 // Check if the load is progressing this often.
-static const double progressHeartbeatInterval = 0.1;
+static const Seconds progressHeartbeatInterval { 100_ms };
 
 // How many heartbeats must pass without progress before deciding the load is currently stalled.
 static const unsigned loadStalledHeartbeatCount = 4;
index a7c7a58..e3996fd 100644 (file)
@@ -44,8 +44,8 @@ namespace WebCore {
 // Delay time in second for start autoscroll if pointer is in border edge of scrollable element.
 static const double autoscrollDelay = 0.2;
 
-// When the autoscroll or the panScroll is triggered when do the scroll every 0.05s to make it smooth
-static const double autoscrollInterval = 0.05;
+// When the autoscroll or the panScroll is triggered when do the scroll every 50ms to make it smooth.
+static const Seconds autoscrollInterval { 50_ms };
 
 #if ENABLE(PAN_SCROLLING)
 static Frame* getMainFrame(Frame* frame)
index 8e0512b..47560ed 100644 (file)
@@ -121,7 +121,7 @@ namespace WebCore {
 using namespace HTMLNames;
 
 #if PLATFORM(IOS)
-const unsigned scrollFrequency = 1000 / 60;
+static const Seconds scrollFrequency { 1000 / 60. };
 #endif
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame"));
index 2ca86f9..6c4b6d2 100644 (file)
@@ -250,7 +250,7 @@ void PageOverlay::stopFadeOutAnimation()
 void PageOverlay::startFadeAnimation()
 {
     m_fadeAnimationStartTime = currentTime();
-    m_fadeAnimationTimer.startRepeating(1 / fadeAnimationFrameRate);
+    m_fadeAnimationTimer.startRepeating(1_s / fadeAnimationFrameRate);
 }
 
 void PageOverlay::fadeAnimationTimerFired()
index 15eb73f..3129208 100644 (file)
@@ -45,7 +45,6 @@ public:
     bool isActive() const { return TimerBase::isActive() || (m_suspended && m_savedIsActive); }
     bool isSuspended() const { return m_suspended; }
 
-    void startRepeating(double repeatInterval) { startRepeating(Seconds { repeatInterval }); }
     void startOneShot(double interval) { startOneShot(Seconds { interval }); }
 
     Seconds repeatInterval() const;
index 39887f1..278b4cd 100644 (file)
@@ -60,7 +60,7 @@ void WheelEventTestTrigger::setTestCallbackAndStartNotificationTimer(std::functi
     }
     
     if (!m_testTriggerTimer.isActive())
-        m_testTriggerTimer.startRepeating(1.0 / 60.0);
+        m_testTriggerTimer.startRepeating(1_s / 60.);
 }
 
 void WheelEventTestTrigger::deferTestsForReason(ScrollableAreaIdentifier identifier, DeferTestTriggerReason reason)
index 314a8df..a659402 100644 (file)
@@ -76,7 +76,7 @@ public:
     virtual FontCascade systemFont(ThemeFont, FontDescription&) const { return FontCascade(); }
     
     // How fast the caret blinks in text fields.
-    virtual double caretBlinkInterval() const { return 0.5; }
+    virtual Seconds caretBlinkInterval() const { return 500_ms; }
 
     // Notification when the theme has changed
     virtual void themeChanged() { }
index 55f2f24..05174b4 100644 (file)
@@ -54,7 +54,6 @@ public:
 
     WEBCORE_EXPORT void start(Seconds nextFireInterval, Seconds repeatInterval);
 
-    void startRepeating(double repeatInterval) { startRepeating(Seconds { repeatInterval }); }
     void startRepeating(Seconds repeatInterval) { start(repeatInterval, repeatInterval); }
 
     void startOneShot(double interval) { startOneShot(Seconds { interval }); }
index e0ba80f..1e8f7df 100644 (file)
@@ -386,7 +386,7 @@ bool ScrollController::isScrollSnapInProgress() const
 void ScrollController::startSnapRubberbandTimer()
 {
     m_client.startSnapRubberbandTimer();
-    m_snapRubberbandTimer.startRepeating(1.0 / 60.0);
+    m_snapRubberbandTimer.startRepeating(1_s / 60.);
 
     m_client.deferTestsForReason(reinterpret_cast<WheelEventTestTrigger::ScrollableAreaIdentifier>(this), WheelEventTestTrigger::RubberbandInProgress);
 }
@@ -562,7 +562,7 @@ void ScrollController::startScrollSnapTimer()
 
     startDeferringTestsDueToScrollSnapping();
     m_client.startScrollSnapTimer();
-    m_scrollSnapTimer.startRepeating(1.0 / 60.0);
+    m_scrollSnapTimer.startRepeating(1_s / 60.);
 }
 
 void ScrollController::stopScrollSnapTimer()
index 8a90c2b..b8496b1 100644 (file)
@@ -523,7 +523,7 @@ TileGrid::TileCohort TileGrid::oldestTileCohort() const
 
 void TileGrid::scheduleCohortRemoval()
 {
-    const double cohortRemovalTimerSeconds = 1;
+    const Seconds cohortRemovalTimerSeconds { 1_s };
 
     // Start the timer, or reschedule the timer from now if it's already active.
     if (!m_cohortRemovalTimer.isActive())
index 55a8d38..0466f77 100644 (file)
@@ -1949,7 +1949,7 @@ void MediaPlayerPrivateGStreamer::setDownloadBuffering()
     if (shouldDownload) {
         GST_DEBUG("Enabling on-disk buffering");
         g_object_set(m_pipeline.get(), "flags", flags | flagDownload, nullptr);
-        m_fillTimer.startRepeating(0.2);
+        m_fillTimer.startRepeating(200_ms);
     } else {
         GST_DEBUG("Disabling on-disk buffering");
         g_object_set(m_pipeline.get(), "flags", flags & ~flagDownload, nullptr);
index 7ab4383..ce4dabb 100644 (file)
@@ -125,7 +125,7 @@ void MockRealtimeAudioSourceMac::emitSampleBuffers(uint32_t frameCount)
 
 void MockRealtimeAudioSourceMac::reconfigure()
 {
-    m_maximiumFrameCount = WTF::roundUpToPowerOfTwo(renderInterval() / 1000. * sampleRate() * 2);
+    m_maximiumFrameCount = WTF::roundUpToPowerOfTwo(renderInterval().seconds() * sampleRate() * 2);
     ASSERT(m_maximiumFrameCount);
 
     const int bytesPerFloat = sizeof(Float32);
index be6bdbf..c64c640 100644 (file)
@@ -109,7 +109,7 @@ void MockRealtimeAudioSource::startProducingData()
     MockRealtimeMediaSource::startProducingData();
 
     m_startTime = monotonicallyIncreasingTime();
-    m_timer.startRepeating(std::chrono::milliseconds(renderInterval()));
+    m_timer.startRepeating(renderInterval());
 }
 
 void MockRealtimeAudioSource::stopProducingData()
index d8814a3..1331c79 100644 (file)
@@ -58,7 +58,7 @@ protected:
     virtual void render(double) { }
 
     double elapsedTime();
-    static int renderInterval() { return 60; }
+    static Seconds renderInterval() { return 60_ms; }
 
 private:
 
index 33fbb17..8db0a8c 100644 (file)
@@ -101,7 +101,7 @@ void MockRealtimeVideoSource::startProducingData()
     }
 
     m_startTime = monotonicallyIncreasingTime();
-    m_timer.startRepeating(std::chrono::milliseconds(lround(1000 / frameRate())));
+    m_timer.startRepeating(1_ms * lround(1000 / frameRate()));
 }
 
 void MockRealtimeVideoSource::stopProducingData()
@@ -155,7 +155,7 @@ void MockRealtimeVideoSource::initializeSupportedConstraints(RealtimeMediaSource
 bool MockRealtimeVideoSource::applyFrameRate(double rate)
 {
     if (m_timer.isActive())
-        m_timer.startRepeating(std::chrono::milliseconds(lround(1000 / rate)));
+        m_timer.startRepeating(1_ms * lround(1000 / rate));
 
     updateSampleBuffer();
     return true;
index 6059d26..c8704c2 100644 (file)
@@ -168,7 +168,7 @@ void RenderMarquee::start()
         m_stopped = false;
     }
 
-    m_timer.startRepeating(speed() * 0.001);
+    m_timer.startRepeating(1_ms * speed());
 }
 
 void RenderMarquee::suspend()
@@ -230,7 +230,7 @@ void RenderMarquee::updateMarqueeStyle()
     if (speed() != marqueeSpeed()) {
         m_speed = marqueeSpeed();
         if (m_timer.isActive())
-            m_timer.startRepeating(speed() * 0.001);
+            m_timer.startRepeating(1_ms * speed());
     }
     
     // Check the loop count to see if we should now stop.
index 122271e..71d165a 100644 (file)
@@ -178,7 +178,7 @@ public:
 #endif
     virtual void platformColorsDidChange();
 
-    virtual double caretBlinkInterval() const { return 0.5; }
+    virtual Seconds caretBlinkInterval() const { return 500_ms; }
 
     // System fonts and colors for CSS.
     void systemFont(CSSValueID, FontCascadeDescription&) const;
index f560000..17284f4 100644 (file)
@@ -1802,7 +1802,7 @@ bool RenderThemeGtk::paintInnerSpinButton(const RenderObject& renderObject, cons
 }
 #endif // GTK_CHECK_VERSION(3, 20, 0)
 
-double RenderThemeGtk::caretBlinkInterval() const
+Seconds RenderThemeGtk::caretBlinkInterval() const
 {
     GtkSettings* settings = gtk_settings_get_default();
 
@@ -1812,9 +1812,9 @@ double RenderThemeGtk::caretBlinkInterval() const
     g_object_get(settings, "gtk-cursor-blink", &shouldBlink, "gtk-cursor-blink-time", &time, nullptr);
 
     if (!shouldBlink)
-        return 0;
+        return 0_s;
 
-    return time / 2000.;
+    return 2_ms * time;
 }
 
 enum StyleColorType { StyleColorBackground, StyleColorForeground };
index 9172345..7b82d93 100644 (file)
@@ -81,7 +81,7 @@ public:
     Color platformInactiveListBoxSelectionBackgroundColor() const override;
     Color platformInactiveListBoxSelectionForegroundColor() const override;
 
-    double caretBlinkInterval() const override;
+    Seconds caretBlinkInterval() const override;
 
     void platformColorsDidChange() override;
 
index a5ea932..a7766df 100644 (file)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-const double XMLHttpRequestProgressEventThrottle::minimumProgressEventDispatchingIntervalInSeconds = .05; // 50 ms per specification.
+const Seconds XMLHttpRequestProgressEventThrottle::minimumProgressEventDispatchingInterval { 50_ms }; // 50 ms per specification.
 
 XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(EventTarget* target)
     : m_target(target)
@@ -73,12 +73,12 @@ void XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent(bool le
         ASSERT(!m_hasThrottledProgressEvent);
 
         dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total));
-        startRepeating(minimumProgressEventDispatchingIntervalInSeconds);
+        startRepeating(minimumProgressEventDispatchingInterval);
         m_hasThrottledProgressEvent = false;
         return;
     }
 
-    // The timer is already active so minimumProgressEventDispatchingIntervalInSeconds is the least frequent event.
+    // The timer is already active so minimumProgressEventDispatchingInterval is the least frequent event.
     m_hasThrottledProgressEvent = true;
 }
 
index 781d6ec..01c17a6 100644 (file)
@@ -55,7 +55,7 @@ public:
     void resume();
 
 private:
-    static const double minimumProgressEventDispatchingIntervalInSeconds;
+    static const Seconds minimumProgressEventDispatchingInterval;
 
     void fired() override;
     void dispatchDeferredEvents();
index d1b6d4f..651a8c6 100644 (file)
@@ -1,5 +1,17 @@
 2017-04-09  Chris Dumez  <cdumez@apple.com>
 
+        Drop Timer::startRepeating() overload taking a double
+        https://bugs.webkit.org/show_bug.cgi?id=170656
+
+        Reviewed by Yusuke Suzuki.
+
+        Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.
+
+        * Plugins/WebNetscapePluginView.mm:
+        (PluginTimer::start):
+
+2017-04-09  Chris Dumez  <cdumez@apple.com>
+
         Start dropping Timer API dealing with double
         https://bugs.webkit.org/show_bug.cgi?id=170649
 
index fea5500..087fcfb 100644 (file)
@@ -136,7 +136,7 @@ public:
             timeInterval = std::max(timeInterval, ThrottledTimerInterval);
         
         if (m_repeat)
-            startRepeating(timeInterval);
+            startRepeating(Seconds { timeInterval });
         else
             startOneShot(timeInterval);
     }
index 47d73af..adc85fd 100644 (file)
@@ -1,5 +1,16 @@
 2017-04-09  Chris Dumez  <cdumez@apple.com>
 
+        Drop Timer::startRepeating() overload taking a double
+        https://bugs.webkit.org/show_bug.cgi?id=170656
+
+        Reviewed by Yusuke Suzuki.
+
+        Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.
+
+        * FullscreenVideoController.cpp:
+
+2017-04-09  Chris Dumez  <cdumez@apple.com>
+
         Start dropping Timer API dealing with double
         https://bugs.webkit.org/show_bug.cgi?id=170649
 
index bc18deb..8571850 100644 (file)
@@ -52,7 +52,7 @@
 using namespace std;
 using namespace WebCore;
 
-static const float timerInterval = 0.033;
+static const Seconds timerInterval { 33_ms };
 
 // HUD Size
 static const int windowHeight = 59;
index 297e1a2..c2f0e50 100644 (file)
@@ -1,3 +1,23 @@
+2017-04-09  Chris Dumez  <cdumez@apple.com>
+
+        Drop Timer::startRepeating() overload taking a double
+        https://bugs.webkit.org/show_bug.cgi?id=170656
+
+        Reviewed by Yusuke Suzuki.
+
+        Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.
+
+        * Shared/WebMemorySampler.cpp:
+        (WebKit::WebMemorySampler::initializeTimers):
+        * UIProcess/Cocoa/ViewGestureController.cpp:
+        * UIProcess/HighPerformanceGraphicsUsageSampler.cpp:
+        * UIProcess/PerActivityStateCPUUsageSampler.cpp:
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::Timer::start):
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
+        (WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases):
+
 2017-04-09  Jon Lee  <jonlee@apple.com>
 
         [WK2][iOS] Add CoreMedia entitlement for WebProcess
index 053fa6e..babc288 100644 (file)
@@ -88,7 +88,7 @@ void WebMemorySampler::start(const SandboxExtension::Handle& sampleLogFileHandle
 
 void WebMemorySampler::initializeTimers(double interval)
 {
-    m_sampleTimer.startRepeating(1);
+    m_sampleTimer.startRepeating(1_s);
     printf("Started memory sampler for process %s %d", processName().utf8().data(), getpid());
     if (interval > 0) {
         m_stopTimer.startOneShot(interval);
index 49f18e3..799da65 100644 (file)
@@ -41,7 +41,7 @@ using namespace WebCore;
 namespace WebKit {
 
 static const std::chrono::seconds swipeSnapshotRemovalWatchdogAfterFirstVisuallyNonEmptyLayoutDuration = 3s;
-static const std::chrono::milliseconds swipeSnapshotRemovalActiveLoadMonitoringInterval = 250ms;
+static const Seconds swipeSnapshotRemovalActiveLoadMonitoringInterval = 250_ms;
 
 #if PLATFORM(MAC)
 static const std::chrono::seconds swipeSnapshotRemovalWatchdogDuration = 5s;
index 8598950..66455ce 100644 (file)
@@ -33,7 +33,7 @@ namespace WebKit {
 
 using namespace WebCore;
 
-static const std::chrono::minutes samplingInterval { 10 };
+static const Seconds samplingInterval { 10_min };
 
 HighPerformanceGraphicsUsageSampler::HighPerformanceGraphicsUsageSampler(WebProcessPool& webProcessPool)
     : m_webProcessPool(webProcessPool)
index 0c039e6..0d857bb 100644 (file)
@@ -38,7 +38,7 @@ static const int64_t microsecondsPerSecond = 1000000;
 
 using namespace WebCore;
 
-static const std::chrono::minutes loggingInterval { 60 };
+static const Seconds loggingInterval { 60_min };
 
 PerActivityStateCPUUsageSampler::PerActivityStateCPUUsageSampler(WebProcessPool& processPool)
     : m_processPool(processPool)
index 5c9a918..fd36b41 100644 (file)
@@ -326,7 +326,7 @@ NetscapePlugin::Timer::~Timer()
 
 void NetscapePlugin::Timer::start()
 {
-    double timeInterval = m_interval / 1000.0;
+    Seconds timeInterval = 1_ms * m_interval;
 
     if (m_repeat)
         m_timer.startRepeating(timeInterval);
index b926db0..201b3dc 100644 (file)
@@ -45,7 +45,7 @@ using namespace WebCore;
 namespace WebKit {
 
 #ifndef NP_NO_CARBON
-static const double nullEventIntervalActive = 0.02;
+static const Seconds nullEventIntervalActive { 20_ms };
 
 static unsigned buttonStateFromLastMouseEvent;
 
index 912f15c..567e47a 100644 (file)
@@ -404,12 +404,12 @@ bool CompositingCoordinator::paintToSurface(const IntSize& size, CoordinatedSurf
     return m_updateAtlases.last()->paintOnAvailableBuffer(size, atlasID, offset, client);
 }
 
-const double ReleaseInactiveAtlasesTimerInterval = 0.5;
+const Seconds releaseInactiveAtlasesTimerInterval { 500_ms };
 
 void CompositingCoordinator::scheduleReleaseInactiveAtlases()
 {
     if (!m_releaseInactiveAtlasesTimer.isActive())
-        m_releaseInactiveAtlasesTimer.startRepeating(ReleaseInactiveAtlasesTimerInterval);
+        m_releaseInactiveAtlasesTimer.startRepeating(releaseInactiveAtlasesTimerInterval);
 }
 
 void CompositingCoordinator::releaseInactiveAtlasesTimerFired()
@@ -426,7 +426,7 @@ void CompositingCoordinator::releaseAtlases(ReleaseAtlasPolicy policy)
         UpdateAtlas* atlas = m_updateAtlases[i].get();
         bool inUse = atlas->isInUse();
         if (!inUse)
-            atlas->addTimeInactive(ReleaseInactiveAtlasesTimerInterval);
+            atlas->addTimeInactive(releaseInactiveAtlasesTimerInterval.value());
         bool usableForRootContentsLayer = !atlas->supportsAlpha();
         if (atlas->isInactive() || (!inUse && policy == ReleaseUnused)) {
             if (!foundActiveAtlasForRootContentsLayer && !atlasToKeepAnyway && usableForRootContentsLayer)
index 6f2606c..63b3f55 100644 (file)
@@ -1,3 +1,15 @@
+2017-04-09  Chris Dumez  <cdumez@apple.com>
+
+        Drop Timer::startRepeating() overload taking a double
+        https://bugs.webkit.org/show_bug.cgi?id=170656
+
+        Reviewed by Yusuke Suzuki.
+
+        Drop Timer::startRepeating() overload taking a double as people should use Seconds type now.
+
+        * TestWebKitAPI/Tests/WTF/RunLoop.cpp:
+        (TestWebKitAPI::TEST):
+
 2017-04-09  Youenn Fablet  <youenn@apple.com>
 
         Resync WPT tests up to 23cd07d4685d81024b7440e042f8bbdb33e7ddec
index 1dc7e93..d1de031 100644 (file)
@@ -129,7 +129,7 @@ TEST(WTF_RunLoop, RepeatingTimer)
 
     {
         DerivedTimer timer(testFinished);
-        timer.startRepeating(0.01);
+        timer.startRepeating(10_ms);
         Util::run(&testFinished);
     }
 }