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 "platform/scheduler/base/virtual_time_domain.h" | 5 #include "platform/scheduler/base/virtual_time_domain.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "platform/scheduler/base/task_queue_impl.h" | 8 #include "platform/scheduler/base/task_queue_impl.h" |
9 #include "platform/scheduler/base/task_queue_manager.h" | 9 #include "platform/scheduler/base/task_queue_manager.h" |
10 #include "platform/scheduler/base/task_queue_manager_delegate.h" | 10 #include "platform/scheduler/base/task_queue_manager_delegate.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 LazyNow VirtualTimeDomain::CreateLazyNow() const { | 27 LazyNow VirtualTimeDomain::CreateLazyNow() const { |
28 base::AutoLock lock(lock_); | 28 base::AutoLock lock(lock_); |
29 return LazyNow(now_); | 29 return LazyNow(now_); |
30 } | 30 } |
31 | 31 |
32 base::TimeTicks VirtualTimeDomain::Now() const { | 32 base::TimeTicks VirtualTimeDomain::Now() const { |
33 base::AutoLock lock(lock_); | 33 base::AutoLock lock(lock_); |
34 return now_; | 34 return now_; |
35 } | 35 } |
36 | 36 |
37 void VirtualTimeDomain::RequestWakeup(base::TimeTicks now, | 37 void VirtualTimeDomain::RequestWakeupAt(base::TimeTicks now, |
38 base::TimeDelta delay) { | 38 base::TimeTicks run_time) { |
39 // We don't need to do anything here because the caller of AdvanceTo is | 39 // We don't need to do anything here because the caller of AdvanceTo is |
40 // responsible for calling TaskQueueManager::MaybeScheduleImmediateWork if | 40 // responsible for calling TaskQueueManager::MaybeScheduleImmediateWork if |
41 // needed. | 41 // needed. |
42 } | 42 } |
43 | 43 |
| 44 void VirtualTimeDomain::CancelWakeupAt(base::TimeTicks run_time) { |
| 45 // We ignore this because RequestWakeupAt is a NOP. |
| 46 } |
| 47 |
44 base::Optional<base::TimeDelta> VirtualTimeDomain::DelayTillNextTask( | 48 base::Optional<base::TimeDelta> VirtualTimeDomain::DelayTillNextTask( |
45 LazyNow* lazy_now) { | 49 LazyNow* lazy_now) { |
46 return base::nullopt; | 50 return base::nullopt; |
47 } | 51 } |
48 | 52 |
49 void VirtualTimeDomain::AsValueIntoInternal( | 53 void VirtualTimeDomain::AsValueIntoInternal( |
50 base::trace_event::TracedValue* state) const {} | 54 base::trace_event::TracedValue* state) const {} |
51 | 55 |
52 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) { | 56 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) { |
53 base::AutoLock lock(lock_); | 57 base::AutoLock lock(lock_); |
54 DCHECK_GE(now, now_); | 58 DCHECK_GE(now, now_); |
55 now_ = now; | 59 now_ = now; |
56 } | 60 } |
57 | 61 |
58 void VirtualTimeDomain::RequestDoWork() { | 62 void VirtualTimeDomain::RequestDoWork() { |
59 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE); | 63 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE); |
60 } | 64 } |
61 | 65 |
62 const char* VirtualTimeDomain::GetName() const { | 66 const char* VirtualTimeDomain::GetName() const { |
63 return "VirtualTimeDomain"; | 67 return "VirtualTimeDomain"; |
64 } | 68 } |
65 | 69 |
66 } // namespace scheduler | 70 } // namespace scheduler |
67 } // namespace blink | 71 } // namespace blink |
OLD | NEW |