Index: base/task_scheduler/sequence_sort_key.h |
diff --git a/base/task_scheduler/sequence_sort_key.h b/base/task_scheduler/sequence_sort_key.h |
index f2dd561c0fa207d36c97a75d73c0f2694019ff30..4f23767c99e05d4270a2a5841963b32a898066c9 100644 |
--- a/base/task_scheduler/sequence_sort_key.h |
+++ b/base/task_scheduler/sequence_sort_key.h |
@@ -13,19 +13,32 @@ namespace base { |
namespace internal { |
// An immutable representation of the priority of a Sequence. |
danakj
2016/04/27 20:50:59
maybe you should say "immutable but copyable" or "
gab
2016/04/28 13:47:15
Done.
|
-struct BASE_EXPORT SequenceSortKey final { |
+class BASE_EXPORT SequenceSortKey final { |
+ public: |
SequenceSortKey(TaskPriority priority, TimeTicks next_task_sequenced_time); |
bool operator<(const SequenceSortKey& other) const; |
bool operator>(const SequenceSortKey& other) const { return other < *this; } |
+ bool operator==(const SequenceSortKey& other) const { |
+ return priority_ == other.priority_ && |
+ next_task_sequenced_time_ == other.next_task_sequenced_time_; |
+ } |
+ bool operator!=(const SequenceSortKey& other) const { |
+ return !(other == *this); |
+ }; |
+ |
+ private: |
+ // The private section allows this class to keep its immutable property while |
+ // being copy-assignable (i.e. instead of making its members const). |
+ |
// Highest task priority in the sequence at the time this sort key was |
// created. |
- const TaskPriority priority; |
+ TaskPriority priority_; |
// Sequenced time of the next task to run in the sequence at the time this |
// sort key was created. |
- const TimeTicks next_task_sequenced_time; |
+ TimeTicks next_task_sequenced_time_; |
}; |
} // namespace internal |