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

Unified Diff: Source/platform/ThreadTimers.h

Issue 959263002: WIP - not ready for review (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Decouple TimerHeap and ThreadTimers. Created 5 years, 10 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 | « no previous file | Source/platform/ThreadTimers.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/ThreadTimers.h
diff --git a/Source/platform/ThreadTimers.h b/Source/platform/ThreadTimers.h
index cba13bc3b940b1c3ff8bdae4dc7ec944a6f1533d..052df247969cb2e5f427923110e39f4e203622d2 100644
--- a/Source/platform/ThreadTimers.h
+++ b/Source/platform/ThreadTimers.h
@@ -28,6 +28,7 @@
#define ThreadTimers_h
#include "platform/PlatformExport.h"
+#include "platform/TimerHeap.h"
#include "wtf/Noncopyable.h"
#include "wtf/HashSet.h"
#include "wtf/Vector.h"
@@ -38,7 +39,7 @@ class SharedTimer;
class TimerBase;
// A collection of timers per thread. Kept in PlatformThreadData.
-class PLATFORM_EXPORT ThreadTimers {
+class PLATFORM_EXPORT ThreadTimers : public TimerQueueObserver {
WTF_MAKE_NONCOPYABLE(ThreadTimers); WTF_MAKE_FAST_ALLOCATED;
public:
ThreadTimers();
@@ -46,7 +47,7 @@ public:
// On a thread different then main, we should set the thread's instance of the SharedTimer.
void setSharedTimer(SharedTimer*);
- Vector<TimerBase*>& timerHeap() { return m_timerHeap; }
+ TimerHeap& timerHeap() { return m_timerHeap; }
void updateSharedTimer();
void fireTimersInNestedEventLoop();
@@ -54,10 +55,13 @@ public:
private:
static void sharedTimerFired();
+ // TimerQueueObserver
+ virtual void nextFiringTimerChanged() override;
+
void sharedTimerFiredInternal();
void fireTimersInNestedEventLoopInternal();
- Vector<TimerBase*> m_timerHeap;
+ TimerHeap m_timerHeap;
SharedTimer* m_sharedTimer; // External object, can be a run loop on a worker thread. Normally set/reset by worker thread.
bool m_firingTimers; // Reentrancy guard.
double m_pendingSharedTimerFireTime;
« no previous file with comments | « no previous file | Source/platform/ThreadTimers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698