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

Unified Diff: components/scheduler/renderer/throttled_time_domain.cc

Issue 2155143002: Fix a bug that could occasionaly cause setInterval to stop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed ThrottledTimeDomain to be based on RealTimeDomain Created 4 years, 5 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: components/scheduler/renderer/throttled_time_domain.cc
diff --git a/components/scheduler/renderer/throttled_time_domain.cc b/components/scheduler/renderer/throttled_time_domain.cc
index 76a94a2a01a0a17de431057ffa03918254806c73..689d7ab66a7015d0a6ef1800ddf7c86d4d2f61a1 100644
--- a/components/scheduler/renderer/throttled_time_domain.cc
+++ b/components/scheduler/renderer/throttled_time_domain.cc
@@ -4,28 +4,31 @@
#include "components/scheduler/renderer/throttled_time_domain.h"
-#include "base/time/tick_clock.h"
-
namespace scheduler {
ThrottledTimeDomain::ThrottledTimeDomain(TimeDomain::Observer* observer,
- base::TickClock* tick_clock)
- : VirtualTimeDomain(observer, tick_clock->NowTicks()),
- tick_clock_(tick_clock) {}
+ const char* tracing_category)
+ : RealTimeDomain(observer, tracing_category) {}
ThrottledTimeDomain::~ThrottledTimeDomain() {}
-base::TimeTicks ThrottledTimeDomain::ComputeDelayedRunTime(
- base::TimeTicks,
- base::TimeDelta delay) const {
- // We ignore the |time_domain_now| parameter since its the virtual time but we
- // need to use the current real time when computing the delayed runtime. If
- // don't do that, throttled timers may fire sooner than expected.
- return tick_clock_->NowTicks() + delay;
-}
-
const char* ThrottledTimeDomain::GetName() const {
return "ThrottledTimeDomain";
}
+void ThrottledTimeDomain::RequestWakeup(base::TimeTicks now,
+ base::TimeDelta delay) {}
rmcilroy 2016/07/18 15:22:57 Comment on why nothing is done here.
alex clarke (OOO till 29th) 2016/07/18 15:35:52 Good point, thanks!
+
+bool ThrottledTimeDomain::MaybeAdvanceTime() {
+ base::TimeTicks next_run_time;
+ if (!NextScheduledRunTime(&next_run_time))
+ return false;
+
+ base::TimeTicks now = Now();
+ if (now >= next_run_time)
+ return true; // Causes DoWork to post a continuation.
+
+ return false;
+}
+
} // namespace scheduler

Powered by Google App Engine
This is Rietveld 408576698