OLD | NEW |
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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 scoped_refptr<Sequence> sequence) { | 340 scoped_refptr<Sequence> sequence) { |
341 DCHECK(task); | 341 DCHECK(task); |
342 DCHECK(sequence); | 342 DCHECK(sequence); |
343 | 343 |
344 if (!task_tracker_->WillPostTask(task.get())) | 344 if (!task_tracker_->WillPostTask(task.get())) |
345 return false; | 345 return false; |
346 | 346 |
347 if (task->delayed_run_time.is_null()) { | 347 if (task->delayed_run_time.is_null()) { |
348 PostTaskWithSequenceNow(std::move(task), std::move(sequence)); | 348 PostTaskWithSequenceNow(std::move(task), std::move(sequence)); |
349 } else { | 349 } else { |
350 DCHECK(task->task); | 350 // Use CHECK instead of DCHECK to crash earlier. See http://crbug.com/711167 |
| 351 // for details. |
| 352 CHECK(task->task); |
351 delayed_task_manager_->AddDelayedTask( | 353 delayed_task_manager_->AddDelayedTask( |
352 std::move(task), | 354 std::move(task), |
353 Bind( | 355 Bind( |
354 [](scoped_refptr<Sequence> sequence, | 356 [](scoped_refptr<Sequence> sequence, |
355 SchedulerWorkerPool* worker_pool, std::unique_ptr<Task> task) { | 357 SchedulerWorkerPool* worker_pool, std::unique_ptr<Task> task) { |
356 worker_pool->PostTaskWithSequenceNow(std::move(task), | 358 worker_pool->PostTaskWithSequenceNow(std::move(task), |
357 std::move(sequence)); | 359 std::move(sequence)); |
358 }, | 360 }, |
359 std::move(sequence), Unretained(this))); | 361 std::move(sequence), Unretained(this))); |
360 } | 362 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); | 618 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); |
617 idle_workers_stack_.Remove(worker); | 619 idle_workers_stack_.Remove(worker); |
618 } | 620 } |
619 | 621 |
620 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { | 622 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { |
621 return !worker_detachment_disallowed_.IsSet(); | 623 return !worker_detachment_disallowed_.IsSet(); |
622 } | 624 } |
623 | 625 |
624 } // namespace internal | 626 } // namespace internal |
625 } // namespace base | 627 } // namespace base |
OLD | NEW |