| 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 |
| 23 PriorityQueue::SequenceAndSortKey::~SequenceAndSortKey() = default; | 26 PriorityQueue::SequenceAndSortKey::~SequenceAndSortKey() = default; |
| 24 | 27 |
| 25 PriorityQueue::Transaction::Transaction(PriorityQueue* outer_queue) | 28 PriorityQueue::Transaction::Transaction(PriorityQueue* outer_queue) |
| 26 : auto_lock_(outer_queue->container_lock_), outer_queue_(outer_queue) { | 29 : auto_lock_(outer_queue->container_lock_), outer_queue_(outer_queue) { |
| 27 DCHECK(CalledOnValidThread()); | 30 DCHECK(CalledOnValidThread()); |
| 28 } | 31 } |
| 29 | 32 |
| 30 PriorityQueue::Transaction::~Transaction() { | 33 PriorityQueue::Transaction::~Transaction() { |
| 31 DCHECK(CalledOnValidThread()); | 34 DCHECK(CalledOnValidThread()); |
| 32 } | 35 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 68 } |
| 66 | 69 |
| 67 PriorityQueue::~PriorityQueue() = default; | 70 PriorityQueue::~PriorityQueue() = default; |
| 68 | 71 |
| 69 std::unique_ptr<PriorityQueue::Transaction> PriorityQueue::BeginTransaction() { | 72 std::unique_ptr<PriorityQueue::Transaction> PriorityQueue::BeginTransaction() { |
| 70 return WrapUnique(new Transaction(this)); | 73 return WrapUnique(new Transaction(this)); |
| 71 } | 74 } |
| 72 | 75 |
| 73 } // namespace internal | 76 } // namespace internal |
| 74 } // namespace base | 77 } // namespace base |
| OLD | NEW |