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(); | |
22 SequenceSortKey(TaskPriority priority, TimeTicks next_task_post_time); | |
gab
2016/02/18 03:00:46
Add comments on constructors to highlight differen
fdoray
2016/02/18 14:56:12
Default constructor is not needed.
| |
23 | |
24 // Returns true if the the sequence associated with this sort key must run | |
25 // after the sequence associated with |other|. | |
fdoray
2016/02/18 01:46:11
Or, more simply:
Indicates whether the priority o
gab
2016/02/18 03:00:46
Or more simply: no comment as this is implicit fro
fdoray
2016/02/18 14:56:12
Done.
| |
26 bool operator<(const SequenceSortKey& other) const; | |
27 | |
28 // Used for testing. | |
gab
2016/02/18 03:00:46
Wouldn't bother with this comment.
fdoray
2016/02/18 14:56:12
Done.
| |
29 bool operator==(const SequenceSortKey& other) const; | |
30 | |
31 TaskPriority priority() const { return priority_; } | |
32 | |
33 private: | |
34 FRIEND_TEST_ALL_PREFIXES(TaskSchedulerSequenceTest, GetSequenceSortKey); | |
gab
2016/02/18 03:00:46
Let's make this a struct with public members, does
fdoray
2016/02/18 14:56:12
As explained below, the members can't be const. I
| |
35 | |
36 // Highest task priority in the sequence at the time this sort key is created. | |
fdoray
2016/02/18 01:46:11
*was created?
gab
2016/02/18 03:00:46
Yes.
fdoray
2016/02/18 14:56:13
Done.
| |
37 TaskPriority priority_; | |
gab
2016/02/18 03:00:46
const
fdoray
2016/02/18 14:56:12
Sadly, std::priority_queue needs operator=, which
gab
2016/02/18 20:22:34
Ugh :-(... really?! It does in place replacements
gab
2016/02/18 21:21:16
Resurfacing this.
fdoray
2016/02/18 22:19:53
Done.
| |
38 | |
39 // Post time of the next task to run in the sequence. | |
fdoray
2016/02/18 01:46:11
... at the time this sort key was created.
fdoray
2016/02/18 14:56:12
Done.
| |
40 TimeTicks next_task_post_time_; | |
gab
2016/02/18 03:00:46
const
fdoray
2016/02/18 14:56:12
Same comment as above.
| |
41 }; | |
42 | |
43 } // namespace internal | |
44 } // namespace base | |
45 | |
46 #endif // BASE_TASK_SCHEDULER_SEQUENCE_SORT_KEY_H_ | |
OLD | NEW |