| 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 <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 protected: | 64 protected: |
| 65 TaskSchedulerWorkerTest() | 65 TaskSchedulerWorkerTest() |
| 66 : main_entry_called_(WaitableEvent::ResetPolicy::MANUAL, | 66 : main_entry_called_(WaitableEvent::ResetPolicy::MANUAL, |
| 67 WaitableEvent::InitialState::NOT_SIGNALED), | 67 WaitableEvent::InitialState::NOT_SIGNALED), |
| 68 num_get_work_cv_(lock_.CreateConditionVariable()), | 68 num_get_work_cv_(lock_.CreateConditionVariable()), |
| 69 worker_set_(WaitableEvent::ResetPolicy::MANUAL, | 69 worker_set_(WaitableEvent::ResetPolicy::MANUAL, |
| 70 WaitableEvent::InitialState::NOT_SIGNALED) {} | 70 WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 71 | 71 |
| 72 void SetUp() override { | 72 void SetUp() override { |
| 73 worker_ = SchedulerWorker::Create( | 73 worker_ = SchedulerWorker::Create( |
| 74 ThreadPriority::NORMAL, | 74 ThreadPriority::NORMAL, MakeUnique<TestSchedulerWorkerDelegate>(this), |
| 75 WrapUnique(new TestSchedulerWorkerDelegate(this)), | 75 &task_tracker_, SchedulerWorker::InitialState::ALIVE); |
| 76 &task_tracker_, | |
| 77 SchedulerWorker::InitialState::ALIVE); | |
| 78 ASSERT_TRUE(worker_); | 76 ASSERT_TRUE(worker_); |
| 79 worker_set_.Signal(); | 77 worker_set_.Signal(); |
| 80 main_entry_called_.Wait(); | 78 main_entry_called_.Wait(); |
| 81 } | 79 } |
| 82 | 80 |
| 83 void TearDown() override { | 81 void TearDown() override { |
| 84 worker_->JoinForTesting(); | 82 worker_->JoinForTesting(); |
| 85 } | 83 } |
| 86 | 84 |
| 87 size_t TasksPerSequence() const { return GetParam(); } | 85 size_t TasksPerSequence() const { return GetParam(); } |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // OnMainEntry() and GetWork() are called. | 585 // OnMainEntry() and GetWork() are called. |
| 588 worker->WakeUp(); | 586 worker->WakeUp(); |
| 589 delegate_raw->WaitForPriorityVerifiedInGetWork(); | 587 delegate_raw->WaitForPriorityVerifiedInGetWork(); |
| 590 | 588 |
| 591 worker->JoinForTesting(); | 589 worker->JoinForTesting(); |
| 592 } | 590 } |
| 593 | 591 |
| 594 } // namespace | 592 } // namespace |
| 595 } // namespace internal | 593 } // namespace internal |
| 596 } // namespace base | 594 } // namespace base |
| OLD | NEW |