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

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

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 #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 task_scheduler {
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);
23
24 // Returns true if the the sequence associated with this sort key must run
25 // after the sequence associated with |other|.
26 bool operator<(const SequenceSortKey& other) const;
27
28 // Used for testing.
29 bool operator==(const SequenceSortKey& other) const;
30
31 TaskPriority priority() const { return priority_; }
32
33 private:
34 FRIEND_TEST_ALL_PREFIXES(TaskSchedulerSequenceTest, GetSequenceSortKey);
35
36 // Highest task priority in the sequence at the time this sort key is created.
37 TaskPriority priority_;
38
39 // Post time of the next task to run in the sequence.
40 TimeTicks next_task_post_time_;
41 };
42
43 } // namespace task_scheduler
44 } // namespace base
45
46 #endif // BASE_TASK_SCHEDULER_SEQUENCE_SORT_KEY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698