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_thread.h" | 5 #include "base/task_scheduler/scheduler_worker_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/task_scheduler/task_tracker.h" | 12 #include "base/task_scheduler/task_tracker.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 scoped_ptr<SchedulerWorkerThread> | 17 std::unique_ptr<SchedulerWorkerThread> |
18 SchedulerWorkerThread::CreateSchedulerWorkerThread( | 18 SchedulerWorkerThread::CreateSchedulerWorkerThread( |
19 ThreadPriority thread_priority, | 19 ThreadPriority thread_priority, |
20 const Closure& main_entry_callback, | 20 const Closure& main_entry_callback, |
21 const GetWorkCallback& get_work_callback, | 21 const GetWorkCallback& get_work_callback, |
22 const RanTaskFromSequenceCallback& ran_task_from_sequence_callback, | 22 const RanTaskFromSequenceCallback& ran_task_from_sequence_callback, |
23 TaskTracker* task_tracker) { | 23 TaskTracker* task_tracker) { |
24 scoped_ptr<SchedulerWorkerThread> worker_thread(new SchedulerWorkerThread( | 24 std::unique_ptr<SchedulerWorkerThread> worker_thread( |
25 thread_priority, main_entry_callback, get_work_callback, | 25 new SchedulerWorkerThread(thread_priority, main_entry_callback, |
26 ran_task_from_sequence_callback, task_tracker)); | 26 get_work_callback, |
| 27 ran_task_from_sequence_callback, task_tracker)); |
27 | 28 |
28 if (worker_thread->thread_handle_.is_null()) | 29 if (worker_thread->thread_handle_.is_null()) |
29 return nullptr; | 30 return nullptr; |
30 return worker_thread; | 31 return worker_thread; |
31 } | 32 } |
32 | 33 |
33 SchedulerWorkerThread::~SchedulerWorkerThread() { | 34 SchedulerWorkerThread::~SchedulerWorkerThread() { |
34 DCHECK(ShouldExitForTesting()); | 35 DCHECK(ShouldExitForTesting()); |
35 } | 36 } |
36 | 37 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 96 } |
96 } | 97 } |
97 | 98 |
98 bool SchedulerWorkerThread::ShouldExitForTesting() const { | 99 bool SchedulerWorkerThread::ShouldExitForTesting() const { |
99 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); | 100 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); |
100 return should_exit_for_testing_; | 101 return should_exit_for_testing_; |
101 } | 102 } |
102 | 103 |
103 } // namespace internal | 104 } // namespace internal |
104 } // namespace base | 105 } // namespace base |
OLD | NEW |