OLD | NEW |
(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 |
OLD | NEW |