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/priority_queue.h" | 5 #include "base/task_scheduler/priority_queue.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" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey() | 15 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey() |
16 : sort_key(TaskPriority::LOWEST, TimeTicks()) {} | 16 : sort_key(TaskPriority::LOWEST, TimeTicks()) {} |
17 | 17 |
18 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey( | 18 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey( |
19 scoped_refptr<Sequence> sequence, | 19 scoped_refptr<Sequence> sequence, |
20 const SequenceSortKey& sort_key) | 20 const SequenceSortKey& sort_key) |
21 : sequence(std::move(sequence)), sort_key(sort_key) {} | 21 : sequence(std::move(sequence)), sort_key(sort_key) {} |
22 | 22 |
23 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey( | |
24 const SequenceAndSortKey& other) = default; | |
25 | |
26 PriorityQueue::SequenceAndSortKey::~SequenceAndSortKey() = default; | 23 PriorityQueue::SequenceAndSortKey::~SequenceAndSortKey() = default; |
27 | 24 |
28 PriorityQueue::Transaction::Transaction(PriorityQueue* outer_queue) | 25 PriorityQueue::Transaction::Transaction(PriorityQueue* outer_queue) |
29 : auto_lock_(outer_queue->container_lock_), outer_queue_(outer_queue) { | 26 : auto_lock_(outer_queue->container_lock_), outer_queue_(outer_queue) { |
30 DCHECK(CalledOnValidThread()); | 27 DCHECK(CalledOnValidThread()); |
31 } | 28 } |
32 | 29 |
33 PriorityQueue::Transaction::~Transaction() { | 30 PriorityQueue::Transaction::~Transaction() { |
34 DCHECK(CalledOnValidThread()); | 31 DCHECK(CalledOnValidThread()); |
35 } | 32 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 65 } |
69 | 66 |
70 PriorityQueue::~PriorityQueue() = default; | 67 PriorityQueue::~PriorityQueue() = default; |
71 | 68 |
72 std::unique_ptr<PriorityQueue::Transaction> PriorityQueue::BeginTransaction() { | 69 std::unique_ptr<PriorityQueue::Transaction> PriorityQueue::BeginTransaction() { |
73 return WrapUnique(new Transaction(this)); | 70 return WrapUnique(new Transaction(this)); |
74 } | 71 } |
75 | 72 |
76 } // namespace internal | 73 } // namespace internal |
77 } // namespace base | 74 } // namespace base |
OLD | NEW |