| Index: Source/platform/Timer.h
|
| diff --git a/Source/platform/Timer.h b/Source/platform/Timer.h
|
| index 60fec18a6b0356eff0326002f44bd70d8b777ba1..1e4bc6ca3e958a37a9b5374ed02bde9ebca5fb35 100644
|
| --- a/Source/platform/Timer.h
|
| +++ b/Source/platform/Timer.h
|
| @@ -28,7 +28,6 @@
|
|
|
| #include "platform/PlatformExport.h"
|
| #include "platform/heap/Handle.h"
|
| -#include "platform/scheduler/CancellableTaskFactory.h"
|
| #include "public/platform/WebTraceLocation.h"
|
| #include "wtf/AddressSanitizer.h"
|
| #include "wtf/Noncopyable.h"
|
| @@ -72,11 +71,6 @@ public:
|
|
|
| void didChangeAlignmentInterval(double now);
|
|
|
| -#if defined(ADDRESS_SANITIZER)
|
| -protected:
|
| - CancellableTaskFactory& cancellableTaskFactory() { return m_cancellableTaskFactory; }
|
| -#endif
|
| -
|
| private:
|
| virtual void fired() = 0;
|
|
|
| @@ -87,13 +81,43 @@ private:
|
|
|
| void setNextFireTime(double now, double delay);
|
|
|
| - void run();
|
| + void runInternal();
|
| +
|
| + class CancellableTimerTask final : public WebThread::Task {
|
| + WTF_MAKE_NONCOPYABLE(CancellableTimerTask);
|
| + public:
|
| + explicit CancellableTimerTask(TimerBase* timer) : m_timer(timer) { }
|
| +
|
| + ~CancellableTimerTask() override
|
| + {
|
| + if (m_timer)
|
| + m_timer->m_cancellableTimerTask = nullptr;
|
| + }
|
| +
|
| + NO_LAZY_SWEEP_SANITIZE_ADDRESS
|
| + void run() override
|
| + {
|
| + if (m_timer) {
|
| + m_timer->m_cancellableTimerTask = nullptr;
|
| + m_timer->runInternal();
|
| + m_timer = nullptr;
|
| + }
|
| + }
|
| +
|
| + void cancel()
|
| + {
|
| + m_timer = nullptr;
|
| + }
|
| +
|
| + private:
|
| + TimerBase* m_timer; // NOT OWNED
|
| + };
|
|
|
| double m_nextFireTime; // 0 if inactive
|
| double m_unalignedNextFireTime; // m_nextFireTime not considering alignment interval
|
| double m_repeatInterval; // 0 if not repeating
|
| WebTraceLocation m_location;
|
| - CancellableTaskFactory m_cancellableTaskFactory;
|
| + CancellableTimerTask* m_cancellableTimerTask; // NOT OWNED
|
| WebScheduler* m_webScheduler; // Not owned.
|
|
|
| #if ENABLE(ASSERT)
|
| @@ -128,10 +152,6 @@ public:
|
| Timer(TimerFiredClass* o, TimerFiredFunction f)
|
| : m_object(o), m_function(f)
|
| {
|
| -#if ENABLE(LAZY_SWEEPING) && defined(ADDRESS_SANITIZER)
|
| - if (IsGarbageCollectedType<TimerFiredClass>::value)
|
| - cancellableTaskFactory().setUnpoisonBeforeUpdate();
|
| -#endif
|
| }
|
|
|
| protected:
|
| @@ -162,7 +182,7 @@ NO_LAZY_SWEEP_SANITIZE_ADDRESS
|
| inline bool TimerBase::isActive() const
|
| {
|
| ASSERT(m_thread == currentThread());
|
| - return m_cancellableTaskFactory.isPending();
|
| + return m_cancellableTimerTask;
|
| }
|
|
|
| } // namespace blink
|
|
|