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

Unified Diff: Source/platform/scheduler/TracedTask.h

Issue 595023002: Implement idle task scheduling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix comment Created 6 years, 2 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
Index: Source/platform/scheduler/TracedTask.h
diff --git a/Source/platform/scheduler/TracedTask.h b/Source/platform/scheduler/TracedTask.h
index 87f18beec58d5ffefd0d73a249b2ac30771980f6..c21f942b4ca36b139c805c0d10ab90eed8d2c9b2 100644
--- a/Source/platform/scheduler/TracedTask.h
+++ b/Source/platform/scheduler/TracedTask.h
@@ -21,21 +21,50 @@ namespace blink {
class TracedTask {
public:
jochen (gone - plz use gerrit) 2014/10/06 07:33:19 nit. WTF_MAKE_NONCOPYABLE(TracedTask)
rmcilroy 2014/10/06 11:29:42 I can't make this NONCOPYABLE due to the way it is
alexclarke 2014/10/06 11:36:11 Note if we have a *lot* of TracedTasks then the ov
+ virtual void run() const = 0;
+ virtual ~TracedTask();
+
+protected:
+ TracedTask(const TraceLocation&, const char* traceName);
+ void endFlowTraceEvent() const;
+
+ TraceLocation m_location;
jochen (gone - plz use gerrit) 2014/10/06 07:33:19 please add setters and getters instead of exposing
rmcilroy 2014/10/06 11:29:42 Done.
+ const char* m_traceName;
+
+private:
+ // Declared volatile as it is atomically incremented.
+ static volatile int s_nextFlowTraceID;
+ uint64_t m_flowTraceID;
+};
+
+class TracedStandardTask : public TracedTask {
+public:
typedef Function<void()> Task;
- void run() const;
+ virtual void run() const;
+ virtual ~TracedStandardTask();
private:
friend class Scheduler;
jochen (gone - plz use gerrit) 2014/10/06 07:33:19 why does the Scheduler need to be a friend?
rmcilroy 2014/10/06 11:29:42 Because the constructor is private. Happy to make
- TracedTask(const Task&, const TraceLocation&, const char* traceName);
- // Declared volatile as it is atomically incremented.
- static volatile int s_nextFlowTraceID;
+ TracedStandardTask(const Task&, const TraceLocation&, const char* traceName);
- uint64_t m_flowTraceID;
Task m_task;
- TraceLocation m_location;
- const char* m_traceName;
+};
+
+class TracedIdleTask : public TracedTask {
+public:
+ typedef Function<void(double deadlineSeconds)> IdleTask;
+
+ virtual void run() const;
+ virtual ~TracedIdleTask();
+
+private:
+ friend class Scheduler;
+
+ TracedIdleTask(const IdleTask&, const TraceLocation&, const char* traceName);
+
+ IdleTask m_idleTask;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698