Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1325)

Side by Side Diff: base/task_scheduler/priority_queue.cc

Issue 1704113002: TaskScheduler [6] SchedulerWorkerThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s_4_shutdown
Patch Set: CR from robliao Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10
11 namespace base { 11 namespace base {
12 namespace internal { 12 namespace internal {
13 13
14 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey() 14 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey() = default;
15 : sort_key(TaskPriority::LOWEST, TimeTicks()) {}
16 15
17 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey( 16 PriorityQueue::SequenceAndSortKey::SequenceAndSortKey(
18 scoped_refptr<Sequence> sequence, 17 scoped_refptr<Sequence> sequence,
19 SequenceSortKey sort_key) 18 SequenceSortKey sort_key)
20 : sequence(sequence), sort_key(sort_key) {} 19 : sequence(sequence), sort_key(sort_key) {}
gab 2016/03/21 19:11:53 std::move(sequence) (I know it already landed but
robliao 2016/03/21 19:15:40 scoped_ptr now points to std::unique_ptr which doe
gab 2016/03/21 19:55:19 Yes, but here |sequence| is scoped_refptr. I'm no
robliao 2016/03/21 19:59:54 Oops! My mistake. scoped_refptr is CopyConstructab
robliao 2016/03/21 20:06:13 So far I'm reading this as move constructor optimi
21 20
22 PriorityQueue::SequenceAndSortKey::~SequenceAndSortKey() = default; 21 PriorityQueue::SequenceAndSortKey::~SequenceAndSortKey() = default;
23 22
24 bool PriorityQueue::SequenceAndSortKey::is_null() const { 23 bool PriorityQueue::SequenceAndSortKey::is_null() const {
25 return sequence.get() == nullptr; 24 return sequence.get() == nullptr;
26 } 25 }
27 26
28 PriorityQueue::PriorityQueue(const Closure& sequence_inserted_callback) 27 PriorityQueue::PriorityQueue(const Closure& sequence_inserted_callback)
29 : sequence_inserted_callback_(sequence_inserted_callback) { 28 : sequence_inserted_callback_(sequence_inserted_callback) {
30 DCHECK(!sequence_inserted_callback_.is_null()); 29 DCHECK(!sequence_inserted_callback_.is_null());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 87 }
89 88
90 bool PriorityQueue::SequenceAndSortKeyComparator::operator()( 89 bool PriorityQueue::SequenceAndSortKeyComparator::operator()(
91 const scoped_ptr<SequenceAndSortKey>& left, 90 const scoped_ptr<SequenceAndSortKey>& left,
92 const scoped_ptr<SequenceAndSortKey>& right) const { 91 const scoped_ptr<SequenceAndSortKey>& right) const {
93 return left->sort_key < right->sort_key; 92 return left->sort_key < right->sort_key;
94 } 93 }
95 94
96 } // namespace internal 95 } // namespace internal
97 } // namespace base 96 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698