Index: Source/platform/Timer.cpp |
diff --git a/Source/platform/Timer.cpp b/Source/platform/Timer.cpp |
index 202365017771b305dbafcb84c88fd974caeecf8d..5e696440e9d6b07b1ff5f74e2a5e10e1394be961 100644 |
--- a/Source/platform/Timer.cpp |
+++ b/Source/platform/Timer.cpp |
@@ -402,7 +402,7 @@ void TimerBase::fireTimersInNestedEventLoop() |
void TimerBase::didChangeAlignmentInterval() |
{ |
- setNextFireTime(m_unalignedNextFireTime); |
+ this->setNextFireTime(m_unalignedNextFireTime); |
} |
double TimerBase::nextUnalignedFireInterval() const |
@@ -411,4 +411,50 @@ double TimerBase::nextUnalignedFireInterval() const |
return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0); |
} |
+namespace { |
+ |
+class ActiveTimerInstanceTracker final : public GarbageCollectedFinalized<ActiveTimerInstanceTracker> { |
+public: |
+ void add(const void* self, TimerInstanceTracker::TraceMethodTrampoline trampoline) |
+ { |
+ m_activeTimerInstances.add(self, trampoline); |
+ } |
+ |
+ void remove(const void* self) |
+ { |
+ m_activeTimerInstances.remove(self); |
+ } |
+ |
+ void trace(Visitor* visitor) |
+ { |
+ for (const auto& active : m_activeTimerInstances) |
+ active.value(visitor, const_cast<void*>(active.key)); |
+ } |
+ |
+private: |
+ using ActiveTimerInstanceMap = HashMap<const void*, TimerInstanceTracker::TraceMethodTrampoline>; |
+ |
+ ActiveTimerInstanceMap m_activeTimerInstances; |
+}; |
+ |
+static ActiveTimerInstanceTracker& activeTimerInstanceTracker() |
+{ |
+ DEFINE_STATIC_LOCAL(Persistent<ActiveTimerInstanceTracker>, tracker, (new ActiveTimerInstanceTracker)); |
+ return *tracker; |
+} |
+ |
+} |
+ |
+void TimerInstanceTracker::add(const void* self, TraceMethodTrampoline trampoline) |
+{ |
+ ActiveTimerInstanceTracker& tracker = activeTimerInstanceTracker(); |
+ tracker.add(self, trampoline); |
+} |
+ |
+void TimerInstanceTracker::remove(const void* self) |
+{ |
+ ActiveTimerInstanceTracker& tracker = activeTimerInstanceTracker(); |
+ tracker.remove(self); |
+} |
+ |
} // namespace blink |