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

Side by Side Diff: base/task_scheduler/scheduler_worker_pool_impl.cc

Issue 2405243003: TaskScheduler: Replace the SchedulerServiceThread with a base::Thread. (Closed)
Patch Set: self-review Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/task_scheduler/scheduler_worker_pool_impl.h" 5 #include "base/task_scheduler/scheduler_worker_pool_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 void SchedulerWorkerPoolImpl::PostTaskWithSequenceNow( 403 void SchedulerWorkerPoolImpl::PostTaskWithSequenceNow(
404 std::unique_ptr<Task> task, 404 std::unique_ptr<Task> task,
405 scoped_refptr<Sequence> sequence, 405 scoped_refptr<Sequence> sequence,
406 SchedulerWorker* worker) { 406 SchedulerWorker* worker) {
407 DCHECK(task); 407 DCHECK(task);
408 DCHECK(sequence); 408 DCHECK(sequence);
409 DCHECK(!worker || ContainsWorker(workers_, worker)); 409 DCHECK(!worker || ContainsWorker(workers_, worker));
410 410
411 // Confirm that |task| is ready to run (its delayed run time is either null or 411 // Confirm that |task| is ready to run (its delayed run time is either null or
412 // in the past). 412 // in the past).
413 DCHECK_LE(task->delayed_run_time, delayed_task_manager_->Now()); 413 DCHECK_LE(task->delayed_run_time, TimeTicks::Now());
414 414
415 // Because |worker| belongs to this worker pool, we know that the type 415 // Because |worker| belongs to this worker pool, we know that the type
416 // of its delegate is SchedulerWorkerDelegateImpl. 416 // of its delegate is SchedulerWorkerDelegateImpl.
417 PriorityQueue* const priority_queue = 417 PriorityQueue* const priority_queue =
418 worker 418 worker
419 ? static_cast<SchedulerWorkerDelegateImpl*>(worker->delegate()) 419 ? static_cast<SchedulerWorkerDelegateImpl*>(worker->delegate())
420 ->single_threaded_priority_queue() 420 ->single_threaded_priority_queue()
421 : &shared_priority_queue_; 421 : &shared_priority_queue_;
422 DCHECK(priority_queue); 422 DCHECK(priority_queue);
423 423
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); 756 AutoSchedulerLock auto_lock(idle_workers_stack_lock_);
757 idle_workers_stack_.Remove(worker); 757 idle_workers_stack_.Remove(worker);
758 } 758 }
759 759
760 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { 760 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() {
761 return !worker_detachment_disallowed_.IsSet(); 761 return !worker_detachment_disallowed_.IsSet();
762 } 762 }
763 763
764 } // namespace internal 764 } // namespace internal
765 } // namespace base 765 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698