Source/WTF:
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Mar 2017 13:20:52 +0000 (13:20 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Mar 2017 13:20:52 +0000 (13:20 +0000)
commitd8bf5237ac49c40cd3ccdebb165cf96fef87fd51
tree8158d2054a2fe9e11daee8e30cd0c1e81786d031
parent13456f258e60d8fe5f34ab07763490d23482d036
Source/WTF:
Add secondsAs<T> methods to Seconds to convert it to integers with clamp
https://bugs.webkit.org/show_bug.cgi?id=169537

Reviewed by Carlos Garcia Campos.

When using the usual static_cast, infinity becomes 0 accidentally.
It is not intended value when using Seconds for timeout value.
Instead, we use clampToAccepting64 to convert Seconds to
integer values to pass them to the system functions.

* wtf/MathExtras.h:
(clampToAccepting64):
* wtf/Seconds.h:
(WTF::Seconds::minutesAs):
(WTF::Seconds::secondsAs):
(WTF::Seconds::millisecondsAs):
(WTF::Seconds::microsecondsAs):
(WTF::Seconds::nanosecondsAs):
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::dispatchAfter):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::updateReadyTime):

Tools:
[WTF] Clean up RunLoop and WorkQueue with Seconds and Function
https://bugs.webkit.org/show_bug.cgi?id=169537

Reviewed by Carlos Garcia Campos.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/MathExtras.h
Source/WTF/wtf/Seconds.h
Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp
Source/WTF/wtf/glib/RunLoopGLib.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Time.cpp