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

Unified Diff: Source/platform/Timer.h

Issue 189833009: Trace where timers were scheduled in Blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 9 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 4bf89004d96fcfb407e6166329c946d56dac99f5..e5f3b0493ce6db230a4c4de44f4bc0d921075405 100644
--- a/Source/platform/Timer.h
+++ b/Source/platform/Timer.h
@@ -27,6 +27,7 @@
#define Timer_h
#include "platform/PlatformExport.h"
+#include "platform/TraceLocation.h"
#include "wtf/Noncopyable.h"
#include "wtf/Threading.h"
#include "wtf/Vector.h"
@@ -43,13 +44,20 @@ public:
TimerBase();
virtual ~TimerBase();
- void start(double nextFireInterval, double repeatInterval);
+ void start(double nextFireInterval, double repeatInterval, const TraceLocation&);
- void startRepeating(double repeatInterval) { start(repeatInterval, repeatInterval); }
- void startOneShot(double interval) { start(interval, 0); }
+ void startRepeating(double repeatInterval, const TraceLocation& caller)
+ {
+ start(repeatInterval, repeatInterval, caller);
+ }
+ void startOneShot(double interval, const TraceLocation& caller)
+ {
+ start(interval, 0, caller);
+ }
void stop();
bool isActive() const;
+ const TraceLocation& location() const { return m_location; }
double nextFireInterval() const;
double nextUnalignedFireInterval() const;
@@ -95,6 +103,7 @@ private:
int m_heapIndex; // -1 if not in heap
unsigned m_heapInsertionOrder; // Used to keep order among equal-fire-time timers
Vector<TimerBase*>* m_cachedThreadGlobalTimerHeap;
+ TraceLocation m_location;
#ifndef NDEBUG
ThreadIdentifier m_thread;
@@ -139,7 +148,7 @@ public:
{
}
- void restart()
+ void restart(const TraceLocation& caller)
{
// Setting this boolean is much more efficient than calling startOneShot
// again, which might result in rescheduling the system timer which
@@ -149,7 +158,7 @@ public:
m_shouldRestartWhenTimerFires = true;
return;
}
- startOneShot(m_delay);
+ startOneShot(m_delay, caller);
}
using TimerBase::stop;
@@ -160,7 +169,8 @@ private:
{
if (m_shouldRestartWhenTimerFires) {
m_shouldRestartWhenTimerFires = false;
- startOneShot(m_delay);
+ // FIXME: This should not be FROM_HERE.
+ startOneShot(m_delay, FROM_HERE);
return;
}
« 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