diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/page/SuspendableTimer.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/page/SuspendableTimer.h')
-rw-r--r-- | Source/WebCore/page/SuspendableTimer.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Source/WebCore/page/SuspendableTimer.h b/Source/WebCore/page/SuspendableTimer.h index 44cb13856..e15f0a709 100644 --- a/Source/WebCore/page/SuspendableTimer.h +++ b/Source/WebCore/page/SuspendableTimer.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,8 +24,7 @@ * */ -#ifndef SuspendableTimer_h -#define SuspendableTimer_h +#pragma once #include "ActiveDOMObject.h" #include "Timer.h" @@ -34,7 +33,7 @@ namespace WebCore { class SuspendableTimer : private TimerBase, public ActiveDOMObject { public: - explicit SuspendableTimer(ScriptExecutionContext*); + explicit SuspendableTimer(ScriptExecutionContext&); virtual ~SuspendableTimer(); // A hook for derived classes to perform cleanup. @@ -43,11 +42,19 @@ public: // Part of TimerBase interface used by SuspendableTimer clients, modified to work when suspended. bool isActive() const { return TimerBase::isActive() || (m_suspended && m_savedIsActive); } bool isSuspended() const { return m_suspended; } + void startRepeating(double repeatInterval); void startOneShot(double interval); double repeatInterval() const; void augmentFireInterval(double delta); void augmentRepeatInterval(double delta); + + void startRepeating(std::chrono::milliseconds repeatInterval) { startRepeating(msToSeconds(repeatInterval)); } + void startOneShot(std::chrono::milliseconds interval) { startOneShot(msToSeconds(interval)); } + std::chrono::milliseconds repeatIntervalMS() const { return secondsToMS(repeatInterval()); } + void augmentFireInterval(std::chrono::milliseconds delta) { augmentFireInterval(msToSeconds(delta)); } + void augmentRepeatInterval(std::chrono::milliseconds delta) { augmentRepeatInterval(msToSeconds(delta)); } + using TimerBase::didChangeAlignmentInterval; using TimerBase::operator new; using TimerBase::operator delete; @@ -55,14 +62,14 @@ public: void cancel(); // Equivalent to TimerBase::stop(), whose name conflicts with ActiveDOMObject::stop(). private: - virtual void fired() = 0; + void fired() override = 0; - // ActiveDOMObject - virtual bool hasPendingActivity() const final override; - virtual void stop() final override; - virtual bool canSuspend() const final override; - virtual void suspend(ReasonForSuspension) final override; - virtual void resume() final override; + // ActiveDOMObject API. + bool hasPendingActivity() const final; + void stop() final; + bool canSuspendForDocumentSuspension() const final; + void suspend(ReasonForSuspension) final; + void resume() final; bool m_suspended; @@ -72,6 +79,3 @@ private: }; } // namespace WebCore - -#endif // SuspendableTimer_h - |