RESOLVED FIXED164992
Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime
https://bugs.webkit.org/show_bug.cgi?id=164992
Summary Migrate some layout timer-related code from std::chrono to Seconds and Monoto...
Simon Fraser (smfr)
Reported 2016-11-19 12:15:06 PST
Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime
Attachments
Patch (19.06 KB, patch)
2016-11-19 12:18 PST, Simon Fraser (smfr)
no flags
Patch (20.96 KB, patch)
2016-11-19 14:07 PST, Simon Fraser (smfr)
darin: review+
Simon Fraser (smfr)
Comment 1 2016-11-19 12:18:05 PST
Simon Fraser (smfr)
Comment 2 2016-11-19 14:07:28 PST
Darin Adler
Comment 3 2016-11-20 16:13:56 PST
Comment on attachment 295269 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=295269&action=review > Source/WebCore/dom/Document.cpp:2779 > + return Seconds::zero(); Can this just use 0? > Source/WebCore/dom/Document.cpp:2785 > + return std::max<Seconds>(Seconds::zero(), settings()->layoutInterval() - elapsed); Can this just use 0? > Source/WebCore/page/ChromeClient.h:236 > + virtual Seconds eventThrottlingDelay() { return Seconds::zero(); }; Can this just use 0? > Source/WebCore/page/FrameView.cpp:2904 > + Seconds delay = frame().document()->minimumLayoutDelay(); I normally prefer auto for something like this. > Source/WebCore/page/FrameView.cpp:2911 > + m_delayedLayout = delay > Seconds::zero(); Seems strange to have to say "> 0" for this. Is there some other way? > Source/WebCore/page/FrameView.cpp:2948 > + Seconds delay = renderView.document().minimumLayoutDelay(); We should use auto. If we had used auto before then we wouldn’t have to touch this line of code. > Source/WebKit/mac/WebView/WebPreferencesPrivate.h:343 > - (void)_setLayoutInterval:(int)l; > -- (int)_layoutInterval; > +- (int)_layoutInterval; // Milliseonds. Both lines need this, I think.
Simon Fraser (smfr)
Comment 4 2016-11-24 22:10:15 PST
(In reply to comment #3) > Comment on attachment 295269 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=295269&action=review > > > Source/WebCore/dom/Document.cpp:2779 > > + return Seconds::zero(); > > Can this just use 0? I wish; it would reduce the number of changes. Phil, can we make this possible? > > Source/WebCore/page/FrameView.cpp:2911 > > + m_delayedLayout = delay > Seconds::zero(); > > Seems strange to have to say "> 0" for this. Is there some other way? Ditto.
Simon Fraser (smfr)
Comment 5 2016-11-24 22:46:11 PST
I guess we'd need a non-explicit constructor?
Filip Pizlo
Comment 6 2016-11-25 08:23:57 PST
(In reply to comment #5) > I guess we'd need a non-explicit constructor? We could add such a constructor but my thinking was that we want to be explicit about type anytime a raw double becomes Seconds, to minimize the likelihood of someone losing track of units. Do you think this is an OK trade off? We could also add support for liberals. This could lead to shorter syntax when saying zero.
Simon Fraser (smfr)
Comment 7 2016-11-25 19:30:33 PST
(In reply to comment #6) > (In reply to comment #5) > > I guess we'd need a non-explicit constructor? > > We could add such a constructor but my thinking was that we want to be > explicit about type anytime a raw double becomes Seconds, to minimize the > likelihood of someone losing track of units. Do you think this is an OK > trade off? I do think this is OK. A raw 'double' time is almost always seconds, e.g. from currentTime() or currentMonotonicTime(). > We could also add support for liberals. This could lead to shorter syntax > when saying zero. Literals? _s and _ms would be nice.
Simon Fraser (smfr)
Comment 8 2016-11-25 19:31:58 PST
Also, I have a huge patch to convert timers to use Seconds, so would like to decide on something soon :)
Filip Pizlo
Comment 9 2016-11-25 20:38:11 PST
(In reply to comment #7) > (In reply to comment #6) > > (In reply to comment #5) > > > I guess we'd need a non-explicit constructor? > > > > We could add such a constructor but my thinking was that we want to be > > explicit about type anytime a raw double becomes Seconds, to minimize the > > likelihood of someone losing track of units. Do you think this is an OK > > trade off? > > I do think this is OK. A raw 'double' time is almost always seconds, e.g. > from currentTime() or currentMonotonicTime(). > > > We could also add support for liberals. This could lead to shorter syntax > > when saying zero. > > Literals? _s and _ms would be nice. If you had literals would you still need the implicit cast? I like to avoid the implicit constructor, but it's not a big deal to me. I'm fine with you making a call on this and adding what you need. Either implicit casts or literals or both would be ok with me. Happy to review such a patch.
Simon Fraser (smfr)
Comment 10 2016-11-25 20:39:48 PST
Simon Fraser (smfr)
Comment 11 2016-11-26 20:23:24 PST
Csaba Osztrogonác
Comment 12 2016-11-26 23:21:12 PST
(In reply to comment #11) > https://trac.webkit.org/r208982 It broke the iOS build, see build.webkit.org for details.
Simon Fraser (smfr)
Comment 13 2016-11-26 23:28:35 PST
(In reply to comment #12) > (In reply to comment #11) > > https://trac.webkit.org/r208982 > > It broke the iOS build, see build.webkit.org for details. Attempted fix in https://trac.webkit.org/changeset/208986
Note You need to log in before you can comment on or make changes to this bug.