Bug 169537 - [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
Summary: [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-12 21:08 PDT by Yusuke Suzuki
Modified: 2017-03-14 08:43 PDT (History)
9 users (show)

See Also:


Attachments
Patch (27.10 KB, patch)
2017-03-12 21:09 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (4.12 KB, patch)
2017-03-14 04:52 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (8.92 KB, patch)
2017-03-14 05:38 PDT, Yusuke Suzuki
cgarcia: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2017-03-12 21:08:07 PDT
[WTF] Clean up RunLoop and WorkQueue with Seconds and Function
Comment 1 Yusuke Suzuki 2017-03-12 21:09:42 PDT
Created attachment 304220 [details]
Patch
Comment 2 Yusuke Suzuki 2017-03-13 11:27:21 PDT
Comment on attachment 304220 [details]
Patch

Thanks!
Comment 3 WebKit Commit Bot 2017-03-13 11:56:58 PDT
Comment on attachment 304220 [details]
Patch

Clearing flags on attachment: 304220

Committed r213858: <http://trac.webkit.org/changeset/213858>
Comment 4 WebKit Commit Bot 2017-03-13 11:57:05 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Carlos Garcia Campos 2017-03-14 04:05:11 PDT
Comment on attachment 304220 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304220&action=review

> Source/WTF/wtf/glib/RunLoopGLib.cpp:-198
> -    auto intervalDuration = std::chrono::duration<double>(fireInterval);
> -    auto safeDuration = std::chrono::microseconds::max();
> -    if (intervalDuration < safeDuration)
> -        safeDuration = std::chrono::duration_cast<std::chrono::microseconds>(intervalDuration);

Something like this is still needed. GSoure works with microseconds, when std::numeric_limits<double>::infinity() is passed here (like XMLHttpRequest does to disable network timeouts), we will overflow later when trying to convert infinity to microseconds
Comment 6 Carlos Garcia Campos 2017-03-14 04:18:46 PDT
Comment on attachment 304220 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304220&action=review

> Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp:42
> -    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, duration.count()), m_dispatchQueue, BlockPtr<void ()>::fromCallable([protectedThis = makeRef(*this), function = WTFMove(function)] {
> +    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, duration.nanoseconds()), m_dispatchQueue, BlockPtr<void()>::fromCallable([protectedThis = makeRef(*this), function = WTFMove(function)] {

This could also overflow now, I think. It doesn't probably happen because dispatchAfter is never called with infinity or a long enough value.
Comment 7 Yusuke Suzuki 2017-03-14 04:52:10 PDT
Reopening to attach new patch.
Comment 8 Yusuke Suzuki 2017-03-14 04:52:15 PDT
Created attachment 304372 [details]
Patch
Comment 9 Yusuke Suzuki 2017-03-14 05:38:04 PDT
Created attachment 304373 [details]
Patch
Comment 10 Carlos Garcia Campos 2017-03-14 06:09:56 PDT
Comment on attachment 304373 [details]
Patch

This looks good to me. Thanks.
Comment 11 Yusuke Suzuki 2017-03-14 06:21:07 PDT
Committed r213896: <http://trac.webkit.org/changeset/213896>