Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1113)

Unified Diff: Source/platform/Timer.h

Issue 1151633004: Revert of Implement timers by posting delayed tasks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/ThreadTimers.cpp ('k') | Source/platform/Timer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/Timer.h
diff --git a/Source/platform/Timer.h b/Source/platform/Timer.h
index 38d3dc167af334cbdd73cf6ca09f826ace4cab00..fcc01843617f71c3eff8261d914d306ceb1195d6 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"
@@ -66,12 +65,11 @@
double repeatInterval() const { return m_repeatInterval; }
void augmentRepeatInterval(double delta) {
- double now = monotonicallyIncreasingTime();
- setNextFireTime(now, m_nextFireTime - now + delta);
+ setNextFireTime(m_nextFireTime + delta);
m_repeatInterval += delta;
}
- void didChangeAlignmentInterval(double now);
+ void didChangeAlignmentInterval();
private:
virtual void fired() = 0;
@@ -79,16 +77,35 @@
NO_LAZY_SWEEP_SANITIZE_ADDRESS
virtual double alignedFireTime(double fireTime) const { return fireTime; }
- void setNextFireTime(double now, double delay);
+ void checkConsistency() const;
+ void checkHeapIndex() const;
- void run();
+ void setNextFireTime(double);
+
+ NO_LAZY_SWEEP_SANITIZE_ADDRESS
+ bool inHeap() const { return m_heapIndex != -1; }
+
+ bool hasValidHeapPosition() const;
+ void updateHeapIfNeeded(double oldTime);
+
+ void heapDecreaseKey();
+ void heapDelete();
+ void heapDeleteMin();
+ void heapIncreaseKey();
+ void heapInsert();
+ void heapPop();
+ void heapPopMin();
+
+ NO_LAZY_SWEEP_SANITIZE_ADDRESS
+ Vector<TimerBase*>& timerHeap() const { ASSERT(m_cachedThreadGlobalTimerHeap); return *m_cachedThreadGlobalTimerHeap; }
double m_nextFireTime; // 0 if inactive
double m_unalignedNextFireTime; // m_nextFireTime not considering alignment interval
double m_repeatInterval; // 0 if not repeating
+ int m_heapIndex; // -1 if not in heap
+ unsigned m_heapInsertionOrder; // Used to keep order among equal-fire-time timers
+ Vector<TimerBase*>* m_cachedThreadGlobalTimerHeap;
WebTraceLocation m_location;
- CancellableTaskFactory m_cancellableTaskFactory;
- WebScheduler* m_webScheduler; // Not owned.
#if ENABLE(ASSERT)
ThreadIdentifier m_thread;
@@ -147,7 +164,7 @@
inline bool TimerBase::isActive() const
{
ASSERT(m_thread == currentThread());
- return m_cancellableTaskFactory.isPending();
+ return m_nextFireTime;
}
}
« no previous file with comments | « Source/platform/ThreadTimers.cpp ('k') | Source/platform/Timer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698