OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |