| Index: Source/platform/SharedTimer.h
|
| diff --git a/Source/modules/webdatabase/sqlite/SQLiteTransaction.h b/Source/platform/SharedTimer.h
|
| similarity index 54%
|
| copy from Source/modules/webdatabase/sqlite/SQLiteTransaction.h
|
| copy to Source/platform/SharedTimer.h
|
| index d0034b8d43ea52c4fbcda4eaa88ec217b8696b0e..b9567f0bbcb20451fdbc80dd55b1dd613a60d98e 100644
|
| --- a/Source/modules/webdatabase/sqlite/SQLiteTransaction.h
|
| +++ b/Source/platform/SharedTimer.h
|
| @@ -23,35 +23,53 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef SQLiteTransaction_h
|
| -#define SQLiteTransaction_h
|
| +#ifndef SharedTimer_h
|
| +#define SharedTimer_h
|
|
|
| +#include "platform/PlatformExport.h"
|
| #include "wtf/FastAllocBase.h"
|
| #include "wtf/Noncopyable.h"
|
|
|
| namespace blink {
|
|
|
| -class SQLiteDatabase;
|
| +// Each thread has its own single instance of shared timer, which implements this interface.
|
| +// This instance is shared by all timers in the thread.
|
| +// Not intended to be used directly; use the Timer class instead.
|
| +class PLATFORM_EXPORT SharedTimer {
|
| + WTF_MAKE_NONCOPYABLE(SharedTimer); WTF_MAKE_FAST_ALLOCATED(SharedTimer);
|
| +public:
|
| + SharedTimer() { }
|
| + virtual ~SharedTimer() {}
|
| + virtual void setFiredFunction(void (*)()) = 0;
|
| +
|
| + // The fire interval is in seconds relative to the current monotonic clock time.
|
| + virtual void setFireInterval(double) = 0;
|
| + virtual void stop() = 0;
|
| +};
|
| +
|
|
|
| -class SQLiteTransaction {
|
| - WTF_MAKE_NONCOPYABLE(SQLiteTransaction); WTF_MAKE_FAST_ALLOCATED(SQLiteTransaction);
|
| +PLATFORM_EXPORT void setSharedTimerFiredFunction(void (*)());
|
| +PLATFORM_EXPORT void setSharedTimerFireInterval(double);
|
| +PLATFORM_EXPORT void stopSharedTimer();
|
| +
|
| +class PLATFORM_EXPORT MainThreadSharedTimer : public SharedTimer {
|
| public:
|
| - SQLiteTransaction(SQLiteDatabase& db, bool readOnly = false);
|
| - ~SQLiteTransaction();
|
| -
|
| - void begin();
|
| - void commit();
|
| - void rollback();
|
| - void stop();
|
| -
|
| - bool inProgress() const { return m_inProgress; }
|
| - bool wasRolledBackBySqlite() const;
|
| -private:
|
| - SQLiteDatabase& m_db;
|
| - bool m_inProgress;
|
| - bool m_readOnly;
|
| + virtual void setFiredFunction(void (*function)()) override
|
| + {
|
| + setSharedTimerFiredFunction(function);
|
| + }
|
| +
|
| + virtual void setFireInterval(double interval) override
|
| + {
|
| + setSharedTimerFireInterval(interval);
|
| + }
|
| +
|
| + virtual void stop() override
|
| + {
|
| + stopSharedTimer();
|
| + }
|
| };
|
|
|
| } // namespace blink
|
|
|
| -#endif // SQLiteTransation_H
|
| +#endif // SharedTimer_h
|
|
|