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

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc

Issue 2258133002: [scheduler] Implement time-based cpu throttling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed similarity Created 4 years, 3 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: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
index 1b0980a4f4e00ccf236f4bc2250683d0b744c3b7..2bd7aba0233369105e11c91b5d124aca6b8eb035 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
@@ -533,6 +533,20 @@ bool TaskQueueImpl::HasPendingImmediateWork() const {
return !any_thread().immediate_incoming_queue.empty();
}
+bool TaskQueueImpl::NextScheduledWakeUp(base::TimeTicks* wakeup) {
+ LazyNow lazy_now = main_thread_only().time_domain->CreateLazyNow();
+ MoveReadyDelayedTasksToDelayedWorkQueue(&lazy_now);
+
+ if (main_thread_only().delayed_incoming_queue.empty())
+ return false;
+
+ if (wakeup) {
alex clarke (OOO till 29th) 2016/09/07 15:13:07 I don't think we should allow |wakeup| to be null.
altimin 2016/09/09 15:43:57 Done.
+ *wakeup =
+ main_thread_only().delayed_incoming_queue.begin()->delayed_run_time;
+ }
+ return true;
+}
+
void TaskQueueImpl::MoveReadyDelayedTasksToDelayedWorkQueue(LazyNow* lazy_now) {
// Enqueue all delayed tasks that should be running now.
while (!main_thread_only().delayed_incoming_queue.empty()) {

Powered by Google App Engine
This is Rietveld 408576698