Convert DOMTimer to std::chrono::milliseconds
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Mar 2016 18:41:56 +0000 (18:41 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Mar 2016 18:41:56 +0000 (18:41 +0000)
commit290fea0c8901aab78eea56a9dfd1e6f16fea35fd
treeb3335ed2195f5906899cefc16f655afdd232758f
parent62153379afc04e15d1d0f007694ed43d203bec5f
Convert DOMTimer to std::chrono::milliseconds
https://bugs.webkit.org/show_bug.cgi?id=155085

Reviewed by Andreas Kling.

DOMTimer currently uses a mix of millisecond (was int, now std::chrono) and second (as double)
time values. Constant conversion back and forth is a complete mess. Stop that.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::minimumTimerInterval):
(WebCore::Document::timerAlignmentInterval):
* dom/Document.h:
    - double -> std::chrono::milliseconds
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::adjustMinimumTimerInterval):
(WebCore::ScriptExecutionContext::minimumTimerInterval):
(WebCore::ScriptExecutionContext::timerAlignmentInterval):
* dom/ScriptExecutionContext.h:
    - double -> std::chrono::milliseconds
* page/DOMTimer.cpp:
(WebCore::DOMTimer::updateTimerIntervalIfNecessary):
(WebCore::DOMTimer::intervalClampedToMinimum):
(WebCore::DOMTimer::alignedFireTime):
* page/DOMTimer.h:
    - double -> std::chrono::milliseconds
* page/Page.cpp:
(WebCore::Page::setTimerThrottlingState):
(WebCore::Page::setTimerAlignmentIntervalIncreaseLimit):
(WebCore::Page::updateDOMTimerAlignmentInterval):
* page/Page.h:
    - double -> std::chrono::milliseconds
* page/Settings.cpp:
(WebCore::Settings::setNeedsAdobeFrameReloadingQuirk):
(WebCore::Settings::setMinimumDOMTimerInterval):
* page/Settings.h:
    - double -> std::chrono::milliseconds
* page/SuspendableTimer.h:
(WebCore::SuspendableTimer::startRepeating):
(WebCore::SuspendableTimer::startOneShot):
(WebCore::SuspendableTimer::repeatIntervalMS):
(WebCore::SuspendableTimer::augmentFireInterval):
(WebCore::SuspendableTimer::augmentRepeatInterval):
    - added std::chrono::milliseconds interface.
* platform/Timer.cpp:
(WebCore::TimerBase::setNextFireTime):
    - restructured for new alignedFireTime signatured, moved zero-delay handling to here.
      This change made because inside alignedFireTime fireTime will have already been truncated.
* platform/Timer.h:
(WebCore::TimerBase::msToSeconds):
(WebCore::TimerBase::secondsToMS):
    - internal helper functions to bridge std::chrono::milliseconds to internal double.
(WebCore::TimerBase::startRepeating):
(WebCore::TimerBase::startOneShot):
(WebCore::TimerBase::repeatIntervalMS):
(WebCore::TimerBase::augmentFireInterval):
(WebCore::TimerBase::augmentRepeatInterval):
    - expanded std::chrono::milliseconds interface.
(WebCore::TimerBase::alignedFireTime):
    - changed to std::chrono::milliseconds, made return value Optional (null means no alignment).
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setMinimumTimerInterval):
* testing/InternalSettings.h:
    - double -> std::chrono::milliseconds

Source/WebKit/win:

* WebView.cpp:
(WebView::setMinimumTimerInterval):
    - Convert double argument into std::chrono::milliseconds.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197690 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/ScriptExecutionContext.cpp
Source/WebCore/dom/ScriptExecutionContext.h
Source/WebCore/page/DOMTimer.cpp
Source/WebCore/page/DOMTimer.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/page/SuspendableTimer.h
Source/WebCore/platform/Timer.cpp
Source/WebCore/platform/Timer.h
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebView.cpp