| 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.h" | 5 #include "base/task_scheduler/scheduler_worker.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 DCHECK_EQ(detached_thread.get(), this); | 48 DCHECK_EQ(detached_thread.get(), this); |
| 49 PlatformThread::Detach(thread_handle_); | 49 PlatformThread::Detach(thread_handle_); |
| 50 outer_ = nullptr; | 50 outer_ = nullptr; |
| 51 break; | 51 break; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 WaitForWork(); | 54 WaitForWork(); |
| 55 continue; | 55 continue; |
| 56 } | 56 } |
| 57 | 57 |
| 58 outer_->task_tracker_->RunTask(sequence->PeekTask()); | 58 outer_->task_tracker_->RunNextTaskInSequence(sequence.get()); |
| 59 | 59 |
| 60 const bool sequence_became_empty = sequence->PopTask(); | 60 const bool sequence_became_empty = sequence->PopTask(); |
| 61 | 61 |
| 62 // If |sequence| isn't empty immediately after the pop, re-enqueue it to | 62 // If |sequence| isn't empty immediately after the pop, re-enqueue it to |
| 63 // maintain the invariant that a non-empty Sequence is always referenced | 63 // maintain the invariant that a non-empty Sequence is always referenced |
| 64 // by either a PriorityQueue or a SchedulerWorker. If it is empty | 64 // by either a PriorityQueue or a SchedulerWorker. If it is empty |
| 65 // and there are live references to it, it will be enqueued when a Task is | 65 // and there are live references to it, it will be enqueued when a Task is |
| 66 // added to it. Otherwise, it will be destroyed at the end of this scope. | 66 // added to it. Otherwise, it will be destroyed at the end of this scope. |
| 67 if (!sequence_became_empty) | 67 if (!sequence_became_empty) |
| 68 outer_->delegate_->ReEnqueueSequence(std::move(sequence)); | 68 outer_->delegate_->ReEnqueueSequence(std::move(sequence)); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 CreateThread(); | 213 CreateThread(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 bool SchedulerWorker::ShouldExitForTesting() const { | 216 bool SchedulerWorker::ShouldExitForTesting() const { |
| 217 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); | 217 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); |
| 218 return should_exit_for_testing_; | 218 return should_exit_for_testing_; |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace internal | 221 } // namespace internal |
| 222 } // namespace base | 222 } // namespace base |
| OLD | NEW |