| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 DISALLOW_COPY_AND_ASSIGN(ServiceThreadDelegate); | 64 DISALLOW_COPY_AND_ASSIGN(ServiceThreadDelegate); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 SchedulerServiceThread::~SchedulerServiceThread() = default; | 69 SchedulerServiceThread::~SchedulerServiceThread() = default; |
| 70 | 70 |
| 71 // static | 71 // static |
| 72 std::unique_ptr<SchedulerServiceThread> SchedulerServiceThread::Create( | 72 std::unique_ptr<SchedulerServiceThread> SchedulerServiceThread::Create( |
| 73 TaskTracker* task_tracker, DelayedTaskManager* delayed_task_manager) { | 73 TaskTracker* task_tracker, DelayedTaskManager* delayed_task_manager) { |
| 74 std::unique_ptr<SchedulerWorker> worker = | 74 std::unique_ptr<SchedulerWorker> worker = SchedulerWorker::Create( |
| 75 SchedulerWorker::Create( | 75 ThreadPriority::NORMAL, |
| 76 ThreadPriority::NORMAL, | 76 MakeUnique<ServiceThreadDelegate>(delayed_task_manager), task_tracker, |
| 77 WrapUnique(new ServiceThreadDelegate(delayed_task_manager)), | 77 SchedulerWorker::InitialState::ALIVE); |
| 78 task_tracker, | |
| 79 SchedulerWorker::InitialState::ALIVE); | |
| 80 if (!worker) | 78 if (!worker) |
| 81 return nullptr; | 79 return nullptr; |
| 82 | 80 |
| 83 return WrapUnique(new SchedulerServiceThread(std::move(worker))); | 81 return WrapUnique(new SchedulerServiceThread(std::move(worker))); |
| 84 } | 82 } |
| 85 | 83 |
| 86 void SchedulerServiceThread::WakeUp() { | 84 void SchedulerServiceThread::WakeUp() { |
| 87 worker_->WakeUp(); | 85 worker_->WakeUp(); |
| 88 } | 86 } |
| 89 | 87 |
| 90 void SchedulerServiceThread::JoinForTesting() { | 88 void SchedulerServiceThread::JoinForTesting() { |
| 91 worker_->JoinForTesting(); | 89 worker_->JoinForTesting(); |
| 92 } | 90 } |
| 93 | 91 |
| 94 SchedulerServiceThread::SchedulerServiceThread( | 92 SchedulerServiceThread::SchedulerServiceThread( |
| 95 std::unique_ptr<SchedulerWorker> worker) : worker_(std::move(worker)) {} | 93 std::unique_ptr<SchedulerWorker> worker) : worker_(std::move(worker)) {} |
| 96 | 94 |
| 97 } // namespace internal | 95 } // namespace internal |
| 98 } // namespace base | 96 } // namespace base |
| OLD | NEW |