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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/virtual_time_domain.cc

Issue 2812703002: Revert of [scheduler] Add TaskQueue::Observer (Closed)
Patch Set: Manual Revert Created 3 years, 8 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 "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"
11 11
12 namespace blink { 12 namespace blink {
13 namespace scheduler { 13 namespace scheduler {
14 14
15 VirtualTimeDomain::VirtualTimeDomain(base::TimeTicks initial_time) 15 VirtualTimeDomain::VirtualTimeDomain(TimeDomain::Observer* observer,
16 : now_(initial_time), task_queue_manager_(nullptr) {} 16 base::TimeTicks initial_time)
17 : TimeDomain(observer), now_(initial_time), task_queue_manager_(nullptr) {}
17 18
18 VirtualTimeDomain::~VirtualTimeDomain() {} 19 VirtualTimeDomain::~VirtualTimeDomain() {}
19 20
20 void VirtualTimeDomain::OnRegisterWithTaskQueueManager( 21 void VirtualTimeDomain::OnRegisterWithTaskQueueManager(
21 TaskQueueManager* task_queue_manager) { 22 TaskQueueManager* task_queue_manager) {
22 task_queue_manager_ = task_queue_manager; 23 task_queue_manager_ = task_queue_manager;
23 DCHECK(task_queue_manager_); 24 DCHECK(task_queue_manager_);
24 } 25 }
25 26
26 LazyNow VirtualTimeDomain::CreateLazyNow() const { 27 LazyNow VirtualTimeDomain::CreateLazyNow() const {
27 base::AutoLock lock(lock_); 28 base::AutoLock lock(lock_);
28 return LazyNow(now_); 29 return LazyNow(now_);
29 } 30 }
30 31
31 base::TimeTicks VirtualTimeDomain::Now() const { 32 base::TimeTicks VirtualTimeDomain::Now() const {
32 base::AutoLock lock(lock_); 33 base::AutoLock lock(lock_);
33 return now_; 34 return now_;
34 } 35 }
35 36
36 void VirtualTimeDomain::RequestWakeUpAt(base::TimeTicks now, 37 void VirtualTimeDomain::RequestWakeupAt(base::TimeTicks now,
37 base::TimeTicks run_time) { 38 base::TimeTicks run_time) {
38 // 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
39 // responsible for calling TaskQueueManager::MaybeScheduleImmediateWork if 40 // responsible for calling TaskQueueManager::MaybeScheduleImmediateWork if
40 // needed. 41 // needed.
41 } 42 }
42 43
43 void VirtualTimeDomain::CancelWakeUpAt(base::TimeTicks run_time) { 44 void VirtualTimeDomain::CancelWakeupAt(base::TimeTicks run_time) {
44 // We ignore this because RequestWakeUpAt is a NOP. 45 // We ignore this because RequestWakeupAt is a NOP.
45 } 46 }
46 47
47 base::Optional<base::TimeDelta> VirtualTimeDomain::DelayTillNextTask( 48 base::Optional<base::TimeDelta> VirtualTimeDomain::DelayTillNextTask(
48 LazyNow* lazy_now) { 49 LazyNow* lazy_now) {
49 return base::nullopt; 50 return base::nullopt;
50 } 51 }
51 52
52 void VirtualTimeDomain::AsValueIntoInternal( 53 void VirtualTimeDomain::AsValueIntoInternal(
53 base::trace_event::TracedValue* state) const {} 54 base::trace_event::TracedValue* state) const {}
54 55
55 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) { 56 void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) {
56 base::AutoLock lock(lock_); 57 base::AutoLock lock(lock_);
57 DCHECK_GE(now, now_); 58 DCHECK_GE(now, now_);
58 now_ = now; 59 now_ = now;
59 } 60 }
60 61
61 void VirtualTimeDomain::RequestDoWork() { 62 void VirtualTimeDomain::RequestDoWork() {
62 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE); 63 task_queue_manager_->MaybeScheduleImmediateWork(FROM_HERE);
63 } 64 }
64 65
65 const char* VirtualTimeDomain::GetName() const { 66 const char* VirtualTimeDomain::GetName() const {
66 return "VirtualTimeDomain"; 67 return "VirtualTimeDomain";
67 } 68 }
68 69
69 } // namespace scheduler 70 } // namespace scheduler
70 } // namespace blink 71 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698