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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/scheduler/renderer/throttled_time_domain.h" 5 #include "components/scheduler/renderer/throttled_time_domain.h"
6 6
7 #include "base/time/tick_clock.h" 7 #include "base/time/tick_clock.h"
8 8
9 namespace scheduler { 9 namespace scheduler {
10 10
11 ThrottledTimeDomain::ThrottledTimeDomain(TimeDomain::Observer* observer, 11 ThrottledTimeDomain::ThrottledTimeDomain(TimeDomain::Observer* observer,
12 base::TickClock* tick_clock) 12 base::TickClock* tick_clock)
13 : VirtualTimeDomain(observer, tick_clock->NowTicks()), 13 : VirtualTimeDomain(observer, tick_clock->NowTicks()),
14 tick_clock_(tick_clock) {} 14 tick_clock_(tick_clock) {}
15 15
16 ThrottledTimeDomain::~ThrottledTimeDomain() {} 16 ThrottledTimeDomain::~ThrottledTimeDomain() {}
17 17
18 base::TimeTicks ThrottledTimeDomain::ComputeDelayedRunTime( 18 base::TimeTicks ThrottledTimeDomain::BlinkNow() const {
rmcilroy 2016/07/18 13:03:03 As discussed offline, could we see whether it is p
alex clarke (OOO till 29th) 2016/07/18 15:02:01 Done.
19 base::TimeTicks, 19 // Report the real time to Blink.
20 base::TimeDelta delay) const { 20 return tick_clock_->NowTicks();
21 // We ignore the |time_domain_now| parameter since its the virtual time but we
22 // need to use the current real time when computing the delayed runtime. If
23 // don't do that, throttled timers may fire sooner than expected.
24 return tick_clock_->NowTicks() + delay;
25 } 21 }
26 22
27 const char* ThrottledTimeDomain::GetName() const { 23 const char* ThrottledTimeDomain::GetName() const {
28 return "ThrottledTimeDomain"; 24 return "ThrottledTimeDomain";
29 } 25 }
30 26
31 } // namespace scheduler 27 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/renderer/throttled_time_domain.h ('k') | components/scheduler/renderer/throttling_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698