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 #ifndef BASE_TASK_SCHEDULER_SEQUENCE_SORT_KEY_H_ |
| 6 #define BASE_TASK_SCHEDULER_SEQUENCE_SORT_KEY_H_ |
| 7 |
| 8 #include "base/base_export.h" |
| 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/task_scheduler/task_traits.h" |
| 11 #include "base/time/time.h" |
| 12 |
| 13 namespace base { |
| 14 namespace internal { |
| 15 |
| 16 // A SequenceSortKey determines the position of a Sequence in a PriorityQueue. |
| 17 // Contrary to a Sequence, which can be modified when it is inside a |
| 18 // PriorityQueue, a SequenceSortKey is immutable. |
| 19 class BASE_EXPORT SequenceSortKey { |
| 20 public: |
| 21 SequenceSortKey(TaskPriority priority, TimeTicks next_task_sequenced_time); |
| 22 |
| 23 bool operator<(const SequenceSortKey& other) const; |
| 24 bool operator==(const SequenceSortKey& other) const; |
| 25 |
| 26 TaskPriority priority() const { return priority_; } |
| 27 |
| 28 private: |
| 29 FRIEND_TEST_ALL_PREFIXES(TaskSchedulerSequenceTest, GetSortKey); |
| 30 |
| 31 // Highest task priority in the sequence at the time this sort key was |
| 32 // created. |
| 33 TaskPriority priority_; |
| 34 |
| 35 // Sequenced time of the next task to run in the sequence at the time this |
| 36 // sort key was created. |
| 37 TimeTicks next_task_sequenced_time_; |
| 38 }; |
| 39 |
| 40 } // namespace internal |
| 41 } // namespace base |
| 42 |
| 43 #endif // BASE_TASK_SCHEDULER_SEQUENCE_SORT_KEY_H_ |
OLD | NEW |