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

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

Issue 2644553002: Refactor TimeDomain::MaybeAdvanceTime in preparation for DoWork deduping (Closed)
Patch Set: Rebased Created 3 years, 11 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/time_domain.h" 5 #include "platform/scheduler/base/time_domain.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "platform/scheduler/base/task_queue_impl.h" 9 #include "platform/scheduler/base/task_queue_impl.h"
10 #include "platform/scheduler/base/task_queue_manager_delegate.h" 10 #include "platform/scheduler/base/task_queue_manager_delegate.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 internal::TaskQueueImpl* queue) { 110 internal::TaskQueueImpl* queue) {
111 { 111 {
112 base::AutoLock lock(has_incoming_immediate_work_lock_); 112 base::AutoLock lock(has_incoming_immediate_work_lock_);
113 has_incoming_immediate_work_.insert(queue); 113 has_incoming_immediate_work_.insert(queue);
114 } 114 }
115 115
116 if (observer_) 116 if (observer_)
117 observer_->OnTimeDomainHasImmediateWork(queue); 117 observer_->OnTimeDomainHasImmediateWork(queue);
118 } 118 }
119 119
120 void TimeDomain::UpdateWorkQueues(LazyNow lazy_now) { 120 void TimeDomain::UpdateWorkQueues(LazyNow* lazy_now) {
121 DCHECK(main_thread_checker_.CalledOnValidThread()); 121 DCHECK(main_thread_checker_.CalledOnValidThread());
122 122
123 // Move any ready delayed tasks into the Incoming queues. 123 // Move any ready delayed tasks into the Incoming queues.
124 WakeupReadyDelayedQueues(&lazy_now); 124 WakeupReadyDelayedQueues(lazy_now);
125 125
126 std::set<internal::TaskQueueImpl*> queues_to_reload_if_empty; 126 std::set<internal::TaskQueueImpl*> queues_to_reload_if_empty;
127 127
128 { 128 {
129 base::AutoLock lock(has_incoming_immediate_work_lock_); 129 base::AutoLock lock(has_incoming_immediate_work_lock_);
130 std::swap(queues_to_reload_if_empty, has_incoming_immediate_work_); 130 std::swap(queues_to_reload_if_empty, has_incoming_immediate_work_);
131 } 131 }
132 132
133 for (internal::TaskQueueImpl* queue : queues_to_reload_if_empty) 133 for (internal::TaskQueueImpl* queue : queues_to_reload_if_empty)
134 queue->ReloadImmediateWorkQueueIfEmpty(); 134 queue->ReloadImmediateWorkQueueIfEmpty();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (!delayed_wakeup_queue_.empty()) { 181 if (!delayed_wakeup_queue_.empty()) {
182 base::TimeDelta delay = delayed_wakeup_queue_.min().time - Now(); 182 base::TimeDelta delay = delayed_wakeup_queue_.min().time - Now();
183 state->SetDouble("next_delay_ms", delay.InMillisecondsF()); 183 state->SetDouble("next_delay_ms", delay.InMillisecondsF());
184 } 184 }
185 AsValueIntoInternal(state); 185 AsValueIntoInternal(state);
186 state->EndDictionary(); 186 state->EndDictionary();
187 } 187 }
188 188
189 } // namespace scheduler 189 } // namespace scheduler
190 } // namespace blink 190 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698