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

Unified Diff: components/scheduler/base/time_domain.h

Issue 1441073006: Move throttling of background timers into the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed various dchecks Created 5 years, 1 month 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: components/scheduler/base/time_domain.h
diff --git a/components/scheduler/base/time_domain.h b/components/scheduler/base/time_domain.h
index 476a68eb5f4299f78b66d2b069fef24320a1b37a..1f58150bdffc73674003840c28d1ea464b6ea7db 100644
--- a/components/scheduler/base/time_domain.h
+++ b/components/scheduler/base/time_domain.h
@@ -43,6 +43,20 @@ class SCHEDULER_EXPORT TimeDomain : public base::RefCounted<TimeDomain> {
// runtime for the next one and it returns true. Returns false otherwise.
bool NextScheduledRunTime(base::TimeTicks* out_time) const;
+ class SCHEDULER_EXPORT Observer {
+ public:
+ virtual ~Observer() {}
+
+ // Called when RegisterAsUpdatableTaskQueue is called. Can fire from any
+ // thread.
+ virtual void OnRegisterAsUpdatableTaskQueue() = 0;
Sami 2015/11/24 12:48:48 How about OnHasNewWork, OnNewIncomingWork, OnNewIm
alex clarke (OOO till 29th) 2015/11/25 12:29:36 Done.
+
+ // Called when RequestWakeup is called. Called only from the main thread.
+ virtual void OnRequestWakeup() = 0;
+ };
+
+ void SetObserver(Observer* observer);
+
protected:
friend class internal::TaskQueueImpl;
friend class TaskQueueManager;
@@ -115,6 +129,8 @@ class SCHEDULER_EXPORT TimeDomain : public base::RefCounted<TimeDomain> {
// only be accessed from the main thread.
std::set<internal::TaskQueueImpl*> updatable_queue_set_;
+ Observer* observer_;
+
base::ThreadChecker main_thread_checker_;
DISALLOW_COPY_AND_ASSIGN(TimeDomain);

Powered by Google App Engine
This is Rietveld 408576698