Bug 170625 - Start using MonotonicTime / Seconds in Timer class
Summary: Start using MonotonicTime / Seconds in Timer class
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks: 170639
  Show dependency treegraph
 
Reported: 2017-04-07 16:13 PDT by Chris Dumez
Modified: 2017-04-07 21:40 PDT (History)
6 users (show)

See Also:


Attachments
Patch (26.45 KB, patch)
2017-04-07 16:16 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (27.75 KB, patch)
2017-04-07 17:03 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-04-07 16:13:47 PDT
Start using MonotonicTime / Seconds in Timer class.
Comment 1 Chris Dumez 2017-04-07 16:16:41 PDT
Created attachment 306546 [details]
Patch
Comment 2 Simon Fraser (smfr) 2017-04-07 16:55:58 PDT
Comment on attachment 306546 [details]
Patch

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

> Source/WebCore/page/SuspendableTimer.cpp:118
> +        m_savedRepeatInterval = Seconds { 0 };

0_s

> Source/WebCore/page/SuspendableTimer.cpp:128
>      return 0;

Why not change this function to return a Seconds?

> Source/WebCore/page/SuspendableTimer.cpp:140
> +        m_savedRepeatInterval = Seconds { 0 };

0_s

> Source/WebCore/platform/ThreadTimers.cpp:46
> +static const Seconds maxDurationOfFiringTimers { 0.050 };

50_ms

> Source/WebCore/platform/ThreadTimers.cpp:92
> +        m_sharedTimer->setFireInterval(std::max(nextFireTime - currentMonotonicTime, Seconds { }));

0_s

> Source/WebCore/platform/ThreadTimers.cpp:122
> +        if (!m_firingTimers || timeToQuit < MonotonicTime::now())
>              break;

Should we capture MonotonicTime::now() outside the loop?

> Source/WebCore/platform/Timer.cpp:216
> +    m_repeatInterval = Seconds { };

0_s

> Source/WebCore/platform/Timer.cpp:220
> +    ASSERT(m_repeatInterval == Seconds { 0 });

0_s

> Source/WebCore/platform/Timer.cpp:224
>  double TimerBase::nextFireInterval() const

Return a Seconds?

> Source/WebCore/platform/Timer.cpp:416
> +    return std::max(m_unalignedNextFireTime - MonotonicTime::now(), Seconds { 0 });

0_s

> Source/WebCore/platform/Timer.h:68
> +    void startOneShot(Seconds interval) { start(interval, Seconds { 0 }); }

0_s
Comment 3 Chris Dumez 2017-04-07 17:00:21 PDT
Will update the return values in a follow-up patch to keep patch size small.
Comment 4 Chris Dumez 2017-04-07 17:03:29 PDT
Created attachment 306551 [details]
Patch
Comment 5 WebKit Commit Bot 2017-04-07 18:33:58 PDT
Comment on attachment 306551 [details]
Patch

Clearing flags on attachment: 306551

Committed r215136: <http://trac.webkit.org/changeset/215136>
Comment 6 WebKit Commit Bot 2017-04-07 18:33:59 PDT
All reviewed patches have been landed.  Closing bug.