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

Unified Diff: third_party/WebKit/Source/platform/scheduler/renderer/throttled_time_domain.cc

Issue 2546423002: [Try # 3] Scheduler refactoring to virtually eliminate redundant DoWorks (Closed)
Patch Set: Rebased Created 4 years 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/renderer/throttled_time_domain.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/throttled_time_domain.cc b/third_party/WebKit/Source/platform/scheduler/renderer/throttled_time_domain.cc
index 8f6887cbbf7945f4728d5260322c13c40756a69c..db1d088798fc7e38e84f2f2b509b8e6d243bfa4c 100644
--- a/third_party/WebKit/Source/platform/scheduler/renderer/throttled_time_domain.cc
+++ b/third_party/WebKit/Source/platform/scheduler/renderer/throttled_time_domain.cc
@@ -23,19 +23,20 @@ void ThrottledTimeDomain::RequestWakeup(base::TimeTicks now,
// behalf.
}
-bool ThrottledTimeDomain::MaybeAdvanceTime() {
+base::Optional<base::TimeDelta> ThrottledTimeDomain::DelayTillNextTask(
+ LazyNow* lazy_now) {
base::TimeTicks next_run_time;
if (!NextScheduledRunTime(&next_run_time))
- return false;
+ return base::Optional<base::TimeDelta>();
- base::TimeTicks now = Now();
+ base::TimeTicks now = lazy_now->Now();
if (now >= next_run_time)
- return true; // Causes DoWork to post a continuation.
+ return base::TimeDelta(); // Makes DoWork post an immediate continuation.
- // Unlike RealTimeDomain::MaybeAdvanceTime we don't request a wake up here, we
- // assume the owner (i.e. TaskQueueThrottler) will manage wakeups on our
+ // Unlike RealTimeDomain::ContinuationNeeded we don't request a wake up here,
+ // we assume the owner (i.e. TaskQueueThrottler) will manage wakeups on our
// behalf.
- return false;
+ return base::Optional<base::TimeDelta>();
}
} // namespace scheduler

Powered by Google App Engine
This is Rietveld 408576698