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

Side by Side Diff: components/scheduler/child/task_queue_manager.cc

Issue 1101703003: Adds a SHUTDOWN_TASK_QUEUE and a PreShutdown api to the scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Responding to feedback Created 5 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 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 "components/scheduler/child/task_queue_manager.h" 5 #include "components/scheduler/child/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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 internal::TaskQueue* queue = Queue(queue_index); 542 internal::TaskQueue* queue = Queue(queue_index);
543 queue->SetPumpPolicy(pump_policy); 543 queue->SetPumpPolicy(pump_policy);
544 } 544 }
545 545
546 void TaskQueueManager::PumpQueue(size_t queue_index) { 546 void TaskQueueManager::PumpQueue(size_t queue_index) {
547 DCHECK(main_thread_checker_.CalledOnValidThread()); 547 DCHECK(main_thread_checker_.CalledOnValidThread());
548 internal::TaskQueue* queue = Queue(queue_index); 548 internal::TaskQueue* queue = Queue(queue_index);
549 queue->PumpQueue(); 549 queue->PumpQueue();
550 } 550 }
551 551
552 void TaskQueueManager::FlushQueue(size_t queue_index) {
553 internal::TaskQueue* queue = Queue(queue_index);
554 queue->WillDeleteTaskQueueManager();
555 }
556
552 bool TaskQueueManager::UpdateWorkQueues( 557 bool TaskQueueManager::UpdateWorkQueues(
553 const base::PendingTask* previous_task) { 558 const base::PendingTask* previous_task) {
554 // TODO(skyostil): This is not efficient when the number of queues grows very 559 // TODO(skyostil): This is not efficient when the number of queues grows very
555 // large due to the number of locks taken. Consider optimizing when we get 560 // large due to the number of locks taken. Consider optimizing when we get
556 // there. 561 // there.
557 DCHECK(main_thread_checker_.CalledOnValidThread()); 562 DCHECK(main_thread_checker_.CalledOnValidThread());
558 internal::LazyNow lazy_now(this); 563 internal::LazyNow lazy_now(this);
559 bool has_work = false; 564 bool has_work = false;
560 for (auto& queue : queues_) { 565 for (auto& queue : queues_) {
561 has_work |= queue->UpdateWorkQueue(&lazy_now, previous_task); 566 has_work |= queue->UpdateWorkQueue(&lazy_now, previous_task);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 state->SetInteger("selected_queue", selected_queue); 740 state->SetInteger("selected_queue", selected_queue);
736 return state; 741 return state;
737 } 742 }
738 743
739 void TaskQueueManager::OnTaskQueueEnabled() { 744 void TaskQueueManager::OnTaskQueueEnabled() {
740 DCHECK(main_thread_checker_.CalledOnValidThread()); 745 DCHECK(main_thread_checker_.CalledOnValidThread());
741 MaybePostDoWorkOnMainRunner(); 746 MaybePostDoWorkOnMainRunner();
742 } 747 }
743 748
744 } // namespace scheduler 749 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698