| 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_service_thread.h" | 5 #include "base/task_scheduler/scheduler_service_thread.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 DISALLOW_COPY_AND_ASSIGN(ServiceThreadDelegate); | 69 DISALLOW_COPY_AND_ASSIGN(ServiceThreadDelegate); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 SchedulerServiceThread::~SchedulerServiceThread() = default; | 74 SchedulerServiceThread::~SchedulerServiceThread() = default; |
| 75 | 75 |
| 76 // static | 76 // static |
| 77 std::unique_ptr<SchedulerServiceThread> SchedulerServiceThread::Create( | 77 std::unique_ptr<SchedulerServiceThread> SchedulerServiceThread::Create( |
| 78 TaskTracker* task_tracker, DelayedTaskManager* delayed_task_manager) { | 78 TaskTracker* task_tracker, DelayedTaskManager* delayed_task_manager) { |
| 79 std::unique_ptr<SchedulerWorker> worker = | 79 std::unique_ptr<SchedulerWorker> worker = SchedulerWorker::Create( |
| 80 SchedulerWorker::Create( | 80 ThreadPriority::NORMAL, |
| 81 ThreadPriority::NORMAL, | 81 MakeUnique<ServiceThreadDelegate>(delayed_task_manager), task_tracker, |
| 82 WrapUnique(new ServiceThreadDelegate(delayed_task_manager)), | 82 SchedulerWorker::InitialState::ALIVE); |
| 83 task_tracker, | |
| 84 SchedulerWorker::InitialState::ALIVE); | |
| 85 if (!worker) | 83 if (!worker) |
| 86 return nullptr; | 84 return nullptr; |
| 87 | 85 |
| 88 return WrapUnique(new SchedulerServiceThread(std::move(worker))); | 86 return WrapUnique(new SchedulerServiceThread(std::move(worker))); |
| 89 } | 87 } |
| 90 | 88 |
| 91 void SchedulerServiceThread::WakeUp() { | 89 void SchedulerServiceThread::WakeUp() { |
| 92 worker_->WakeUp(); | 90 worker_->WakeUp(); |
| 93 } | 91 } |
| 94 | 92 |
| 95 void SchedulerServiceThread::JoinForTesting() { | 93 void SchedulerServiceThread::JoinForTesting() { |
| 96 worker_->JoinForTesting(); | 94 worker_->JoinForTesting(); |
| 97 } | 95 } |
| 98 | 96 |
| 99 SchedulerServiceThread::SchedulerServiceThread( | 97 SchedulerServiceThread::SchedulerServiceThread( |
| 100 std::unique_ptr<SchedulerWorker> worker) : worker_(std::move(worker)) {} | 98 std::unique_ptr<SchedulerWorker> worker) : worker_(std::move(worker)) {} |
| 101 | 99 |
| 102 } // namespace internal | 100 } // namespace internal |
| 103 } // namespace base | 101 } // namespace base |
| OLD | NEW |