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

Side by Side Diff: components/scheduler/base/virtual_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/base/virtual_time_domain.h" 5 #include "components/scheduler/base/virtual_time_domain.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/scheduler/base/task_queue_impl.h" 8 #include "components/scheduler/base/task_queue_impl.h"
9 #include "components/scheduler/base/task_queue_manager.h" 9 #include "components/scheduler/base/task_queue_manager.h"
10 #include "components/scheduler/base/task_queue_manager_delegate.h" 10 #include "components/scheduler/base/task_queue_manager_delegate.h"
(...skipping 15 matching lines...) Expand all
26 LazyNow VirtualTimeDomain::CreateLazyNow() const { 26 LazyNow VirtualTimeDomain::CreateLazyNow() const {
27 base::AutoLock lock(lock_); 27 base::AutoLock lock(lock_);
28 return LazyNow(now_); 28 return LazyNow(now_);
29 } 29 }
30 30
31 base::TimeTicks VirtualTimeDomain::Now() const { 31 base::TimeTicks VirtualTimeDomain::Now() const {
32 base::AutoLock lock(lock_); 32 base::AutoLock lock(lock_);
33 return now_; 33 return now_;
34 } 34 }
35 35
36 base::TimeTicks VirtualTimeDomain::ComputeDelayedRunTime( 36 base::TimeTicks VirtualTimeDomain::BlinkNow() const {
37 base::TimeTicks time_domain_now, 37 base::AutoLock lock(lock_);
38 base::TimeDelta delay) const { 38 // The VirtualTimeDomain is special. Entering VirtualTimeDomain is intended
39 return time_domain_now + delay; 39 // to be an one way operation and we really do intend blink to use the virtual
40 // timebase.
41 return now_;
40 } 42 }
41 43
42 void VirtualTimeDomain::RequestWakeup(base::TimeTicks now, 44 void VirtualTimeDomain::RequestWakeup(base::TimeTicks now,
43 base::TimeDelta delay) { 45 base::TimeDelta delay) {
44 // We don't need to do anything here because the caller of AdvanceTo is 46 // We don't need to do anything here because the caller of AdvanceTo is
45 // responsible for calling TaskQueueManager::MaybeScheduleImmediateWork if 47 // responsible for calling TaskQueueManager::MaybeScheduleImmediateWork if
46 // needed. 48 // needed.
47 } 49 }
48 50
49 bool VirtualTimeDomain::MaybeAdvanceTime() { 51 bool VirtualTimeDomain::MaybeAdvanceTime() {
(...skipping 11 matching lines...) Expand all
61 63
62 void VirtualTimeDomain::RequestDoWork() { 64 void VirtualTimeDomain::RequestDoWork() {
63 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE); 65 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE);
64 } 66 }
65 67
66 const char* VirtualTimeDomain::GetName() const { 68 const char* VirtualTimeDomain::GetName() const {
67 return "VirtualTimeDomain"; 69 return "VirtualTimeDomain";
68 } 70 }
69 71
70 } // namespace scheduler 72 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698