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::RequestWakeupAt(LazyNow* lazy_now, | 37 void VirtualTimeDomain::RequestWakeup(base::TimeTicks now, |
38 base::TimeTicks run_time) { | 38 base::TimeDelta delay) { |
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 | |
48 base::Optional<base::TimeDelta> VirtualTimeDomain::DelayTillNextTask( | 44 base::Optional<base::TimeDelta> VirtualTimeDomain::DelayTillNextTask( |
49 LazyNow* lazy_now) { | 45 LazyNow* lazy_now) { |
50 return base::Optional<base::TimeDelta>(); | 46 return base::Optional<base::TimeDelta>(); |
51 } | 47 } |
52 | 48 |
53 void VirtualTimeDomain::AsValueIntoInternal( | 49 void VirtualTimeDomain::AsValueIntoInternal( |
54 base::trace_event::TracedValue* state) const {} | 50 base::trace_event::TracedValue* state) const {} |
55 | 51 |
56 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) { | 52 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) { |
57 base::AutoLock lock(lock_); | 53 base::AutoLock lock(lock_); |
58 DCHECK_GE(now, now_); | 54 DCHECK_GE(now, now_); |
59 now_ = now; | 55 now_ = now; |
60 } | 56 } |
61 | 57 |
62 void VirtualTimeDomain::RequestDoWork() { | 58 void VirtualTimeDomain::RequestDoWork() { |
63 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE); | 59 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE); |
64 } | 60 } |
65 | 61 |
66 const char* VirtualTimeDomain::GetName() const { | 62 const char* VirtualTimeDomain::GetName() const { |
67 return "VirtualTimeDomain"; | 63 return "VirtualTimeDomain"; |
68 } | 64 } |
69 | 65 |
70 } // namespace scheduler | 66 } // namespace scheduler |
71 } // namespace blink | 67 } // namespace blink |
OLD | NEW |