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

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

Issue 1685423002: Task Scheduler. (Closed) Base URL: https://luckyluke-private.googlesource.com/src@a_master
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 task_scheduler {
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_;
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 task_scheduler
34 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698