OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/scheduler/base/virtual_time_domain.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "components/scheduler/base/task_queue_impl.h" |
| 9 #include "components/scheduler/base/task_queue_manager_delegate.h" |
| 10 |
| 11 namespace scheduler { |
| 12 |
| 13 VirtualTimeDomain::VirtualTimeDomain(base::TimeTicks initial_time) |
| 14 : now_(initial_time) {} |
| 15 |
| 16 VirtualTimeDomain::~VirtualTimeDomain() {} |
| 17 |
| 18 LazyNow VirtualTimeDomain::CreateLazyNow() { |
| 19 base::AutoLock lock(lock_); |
| 20 return LazyNow(now_); |
| 21 } |
| 22 |
| 23 void VirtualTimeDomain::RequestWakeup(base::TimeDelta delay) { |
| 24 // We don't need to do anything here because AdvanceTo triggers delayed tasks. |
| 25 } |
| 26 |
| 27 bool VirtualTimeDomain::MaybeAdvanceTime() { |
| 28 return false; |
| 29 } |
| 30 |
| 31 void VirtualTimeDomain::AsValueIntoInternal( |
| 32 base::trace_event::TracedValue* state) const {} |
| 33 |
| 34 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) { |
| 35 base::AutoLock lock(lock_); |
| 36 DCHECK_GE(now, now_); |
| 37 now_ = now; |
| 38 LazyNow lazy_now(now_); |
| 39 WakeupReadyDelayedQueues(&lazy_now); |
| 40 } |
| 41 |
| 42 const char* VirtualTimeDomain::GetName() const { |
| 43 return "VirtualTimeDomain"; |
| 44 } |
| 45 |
| 46 } // namespace scheduler |
OLD | NEW |