Title: [215454] trunk/Source
Revision
215454
Author
[email protected]
Date
2017-04-18 00:28:38 -0700 (Tue, 18 Apr 2017)

Log Message

[JSC][GTK] glib RunLoop does not accept negative start interval
https://bugs.webkit.org/show_bug.cgi?id=170775

Reviewed by Saam Barati.

Source/_javascript_Core:

* heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::scheduleTimer):

Source/WTF:

RunLoop::Timer for glib does not accept negative start interval.
We use 0_s if the given value is negative.

* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::secondsUntilFire):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (215453 => 215454)


--- trunk/Source/_javascript_Core/ChangeLog	2017-04-18 06:43:54 UTC (rev 215453)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-04-18 07:28:38 UTC (rev 215454)
@@ -1,3 +1,13 @@
+2017-04-18  Yusuke Suzuki  <[email protected]>
+
+        [JSC][GTK] glib RunLoop does not accept negative start interval
+        https://bugs.webkit.org/show_bug.cgi?id=170775
+
+        Reviewed by Saam Barati.
+
+        * heap/GCActivityCallback.cpp:
+        (JSC::GCActivityCallback::scheduleTimer):
+
 2017-04-17  Saam Barati  <[email protected]>
 
         BytecodeGenerator ".call" and ".apply" is exponential in nesting depth

Modified: trunk/Source/_javascript_Core/heap/GCActivityCallback.cpp (215453 => 215454)


--- trunk/Source/_javascript_Core/heap/GCActivityCallback.cpp	2017-04-18 06:43:54 UTC (rev 215453)
+++ trunk/Source/_javascript_Core/heap/GCActivityCallback.cpp	2017-04-18 07:28:38 UTC (rev 215454)
@@ -89,7 +89,7 @@
     m_delay = newDelay;
 
     Seconds secondsUntilFire = m_timer.secondsUntilFire();
-    m_timer.startOneShot(secondsUntilFire - delta);
+    m_timer.startOneShot(std::max<Seconds>(secondsUntilFire - delta, 0_s));
 }
 
 void GCActivityCallback::cancelTimer()

Modified: trunk/Source/WTF/ChangeLog (215453 => 215454)


--- trunk/Source/WTF/ChangeLog	2017-04-18 06:43:54 UTC (rev 215453)
+++ trunk/Source/WTF/ChangeLog	2017-04-18 07:28:38 UTC (rev 215454)
@@ -1,3 +1,16 @@
+2017-04-18  Yusuke Suzuki  <[email protected]>
+
+        [JSC][GTK] glib RunLoop does not accept negative start interval
+        https://bugs.webkit.org/show_bug.cgi?id=170775
+
+        Reviewed by Saam Barati.
+
+        RunLoop::Timer for glib does not accept negative start interval.
+        We use 0_s if the given value is negative.
+
+        * wtf/glib/RunLoopGLib.cpp:
+        (WTF::RunLoop::TimerBase::secondsUntilFire):
+
 2017-04-17  Alex Christensen  <[email protected]>
 
         Allow Variants of RetainPtrs

Modified: trunk/Source/WTF/wtf/RunLoop.h (215453 => 215454)


--- trunk/Source/WTF/wtf/RunLoop.h	2017-04-18 06:43:54 UTC (rev 215453)
+++ trunk/Source/WTF/wtf/RunLoop.h	2017-04-18 07:28:38 UTC (rev 215454)
@@ -84,12 +84,12 @@
         WTF_EXPORT_PRIVATE explicit TimerBase(RunLoop&);
         WTF_EXPORT_PRIVATE virtual ~TimerBase();
 
-        void startRepeating(double repeatInterval) { start(repeatInterval, true); }
+        void startRepeating(double repeatInterval) { startInternal(repeatInterval, true); }
         void startRepeating(std::chrono::milliseconds repeatInterval) { startRepeating(repeatInterval.count() * 0.001); }
         void startRepeating(Seconds repeatInterval) { startRepeating(repeatInterval.value()); }
-        void startOneShot(double interval) { start(interval, false); }
-        void startOneShot(std::chrono::milliseconds interval) { start(interval.count() * 0.001, false); }
-        void startOneShot(Seconds interval) { start(interval.value(), false); }
+        void startOneShot(double interval) { startInternal(interval, false); }
+        void startOneShot(std::chrono::milliseconds interval) { startOneShot(interval.count() * 0.001); }
+        void startOneShot(Seconds interval) { startOneShot(interval.value()); }
 
         WTF_EXPORT_PRIVATE void stop();
         WTF_EXPORT_PRIVATE bool isActive() const;
@@ -103,6 +103,11 @@
 #endif
 
     private:
+        void startInternal(double nextFireInterval, bool repeat)
+        {
+            start(std::max(nextFireInterval, 0.0), repeat);
+        }
+
         WTF_EXPORT_PRIVATE void start(double nextFireInterval, bool repeat);
 
         Ref<RunLoop> m_runLoop;

Modified: trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp (215453 => 215454)


--- trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp	2017-04-18 06:43:54 UTC (rev 215453)
+++ trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp	2017-04-18 07:28:38 UTC (rev 215454)
@@ -218,7 +218,10 @@
 
 Seconds RunLoop::TimerBase::secondsUntilFire() const
 {
-    return std::max<Seconds>(Seconds::fromMicroseconds(g_source_get_ready_time(m_source.get()) - g_get_monotonic_time()), 0_s);
+    gint64 time = g_source_get_ready_time(m_source.get());
+    if (time != -1)
+        return std::max<Seconds>(Seconds::fromMicroseconds(time - g_get_monotonic_time()), 0_s);
+    return 0_s;
 }
 
 } // namespace WTF
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to