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

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

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: still need to check MessageLoop::current() in Mojo's RunLoopNestingObserver::GetForThread() Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/task_queue_manager.h" 5 #include "platform/scheduler/base/task_queue_manager.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 for (TimeDomain* time_domain : time_domains_) { 165 for (TimeDomain* time_domain : time_domains_) {
166 if (time_domain == real_time_domain_.get()) { 166 if (time_domain == real_time_domain_.get()) {
167 time_domain->WakeUpReadyDelayedQueues(lazy_now); 167 time_domain->WakeUpReadyDelayedQueues(lazy_now);
168 } else { 168 } else {
169 LazyNow time_domain_lazy_now = time_domain->CreateLazyNow(); 169 LazyNow time_domain_lazy_now = time_domain->CreateLazyNow();
170 time_domain->WakeUpReadyDelayedQueues(&time_domain_lazy_now); 170 time_domain->WakeUpReadyDelayedQueues(&time_domain_lazy_now);
171 } 171 }
172 } 172 }
173 } 173 }
174 174
175 void TaskQueueManager::OnBeginNestedMessageLoop() { 175 void TaskQueueManager::OnBeginNestedRunLoop() {
176 // We just entered a nested message loop, make sure there's a DoWork posted or 176 // We just entered a nested message loop, make sure there's a DoWork posted or
177 // the system will grind to a halt. 177 // the system will grind to a halt.
178 { 178 {
179 base::AutoLock lock(any_thread_lock_); 179 base::AutoLock lock(any_thread_lock_);
180 any_thread().immediate_do_work_posted_count++; 180 any_thread().immediate_do_work_posted_count++;
181 any_thread().is_nested = true; 181 any_thread().is_nested = true;
182 } 182 }
183 183
184 // When a nested message loop starts, task time observers may want to ignore 184 // When a nested message loop starts, task time observers may want to ignore
185 // the current task. 185 // the current task.
186 for (auto& observer : task_time_observers_) 186 for (auto& observer : task_time_observers_)
187 observer.OnBeginNestedMessageLoop(); 187 observer.OnBeginNestedRunLoop();
188 188
189 delegate_->PostTask(FROM_HERE, immediate_do_work_closure_); 189 delegate_->PostTask(FROM_HERE, immediate_do_work_closure_);
190 } 190 }
191 191
192 void TaskQueueManager::OnQueueHasIncomingImmediateWork( 192 void TaskQueueManager::OnQueueHasIncomingImmediateWork(
193 internal::TaskQueueImpl* queue, 193 internal::TaskQueueImpl* queue,
194 internal::EnqueueOrder enqueue_order, 194 internal::EnqueueOrder enqueue_order,
195 bool queue_is_blocked) { 195 bool queue_is_blocked) {
196 MoveableAutoLock lock(any_thread_lock_); 196 MoveableAutoLock lock(any_thread_lock_);
197 any_thread().has_incoming_immediate_work.insert( 197 any_thread().has_incoming_immediate_work.insert(
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 for (const scoped_refptr<internal::TaskQueueImpl>& queue : queues_) { 704 for (const scoped_refptr<internal::TaskQueueImpl>& queue : queues_) {
705 TimeDomain* time_domain = queue->GetTimeDomain(); 705 TimeDomain* time_domain = queue->GetTimeDomain();
706 if (time_domain_now.find(time_domain) == time_domain_now.end()) 706 if (time_domain_now.find(time_domain) == time_domain_now.end())
707 time_domain_now.insert(std::make_pair(time_domain, time_domain->Now())); 707 time_domain_now.insert(std::make_pair(time_domain, time_domain->Now()));
708 queue->SweepCanceledDelayedTasks(time_domain_now[time_domain]); 708 queue->SweepCanceledDelayedTasks(time_domain_now[time_domain]);
709 } 709 }
710 } 710 }
711 711
712 } // namespace scheduler 712 } // namespace scheduler
713 } // namespace blink 713 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698