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

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

Issue 1705253002: TaskScheduler [3/9] Task and Sequence (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s_1_scheduler_lock
Patch Set: Created 4 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/task_scheduler/sequence_sort_key.h"
6
7 namespace base {
8 namespace internal {
9
10 SequenceSortKey::SequenceSortKey() : priority_(TaskPriority::BACKGROUND) {}
11
12 SequenceSortKey::SequenceSortKey(TaskPriority priority,
13 TimeTicks next_task_post_time)
14 : priority_(priority), next_task_post_time_(next_task_post_time) {}
15
16 bool SequenceSortKey::operator<(const SequenceSortKey& other) const {
17 if (static_cast<TaskPriorityUnderlyingType>(priority_) <
18 static_cast<TaskPriorityUnderlyingType>(other.priority_)) {
19 return true;
20 }
21 if (static_cast<TaskPriorityUnderlyingType>(priority_) >
22 static_cast<TaskPriorityUnderlyingType>(other.priority_)) {
23 return false;
24 }
25 return next_task_post_time_ > other.next_task_post_time_;
gab 2016/02/18 03:00:46 How about: -------------- // Sort by highest prio
fdoray 2016/02/18 14:56:12 Done. Note: priority_diff > 0 instead of priorit
gab 2016/02/18 20:22:34 Ah oops, that's because I meant for priority_diff
26 }
27
28 bool SequenceSortKey::operator==(const SequenceSortKey& other) const {
29 return priority_ == other.priority_ &&
30 next_task_post_time_ == other.next_task_post_time_;
31 }
32
33 } // namespace internal
34 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698