Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_TASK_SCHEDULER_SEQUENCE_H_ | 5 #ifndef BASE_TASK_SCHEDULER_SEQUENCE_H_ |
| 6 #define BASE_TASK_SCHEDULER_SEQUENCE_H_ | 6 #define BASE_TASK_SCHEDULER_SEQUENCE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 // | 38 // |
| 39 // This class is thread-safe. | 39 // This class is thread-safe. |
| 40 class BASE_EXPORT Sequence : public RefCountedThreadSafe<Sequence> { | 40 class BASE_EXPORT Sequence : public RefCountedThreadSafe<Sequence> { |
| 41 public: | 41 public: |
| 42 Sequence(); | 42 Sequence(); |
| 43 | 43 |
| 44 // Adds |task| at the end of the sequence's queue. Returns true if the | 44 // Adds |task| at the end of the sequence's queue. Returns true if the |
| 45 // sequence was empty before this operation. | 45 // sequence was empty before this operation. |
| 46 bool PushTask(std::unique_ptr<Task> task); | 46 bool PushTask(std::unique_ptr<Task> task); |
| 47 | 47 |
| 48 // Returns the task in front of the sequence's queue, if any. | 48 // Returns the task in front of the sequence's queue, if any. |
|
fdoray
2016/10/06 17:37:22
// The returned Task is non-const to allow running
tzik
2016/10/13 05:58:04
Reverted this part per your CL.
| |
| 49 const Task* PeekTask() const; | 49 Task* PeekTask() const; |
| 50 | 50 |
| 51 // Removes the task in front of the sequence's queue. Returns true if the | 51 // Removes the task in front of the sequence's queue. Returns true if the |
| 52 // sequence is empty after this operation. Cannot be called on an empty | 52 // sequence is empty after this operation. Cannot be called on an empty |
| 53 // sequence. | 53 // sequence. |
| 54 bool PopTask(); | 54 bool PopTask(); |
| 55 | 55 |
| 56 // Returns a SequenceSortKey representing the priority of the sequence. Cannot | 56 // Returns a SequenceSortKey representing the priority of the sequence. Cannot |
| 57 // be called on an empty sequence. | 57 // be called on an empty sequence. |
| 58 SequenceSortKey GetSortKey() const; | 58 SequenceSortKey GetSortKey() const; |
| 59 | 59 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 76 size_t num_tasks_per_priority_[static_cast<int>(TaskPriority::HIGHEST) + 1] = | 76 size_t num_tasks_per_priority_[static_cast<int>(TaskPriority::HIGHEST) + 1] = |
| 77 {}; | 77 {}; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(Sequence); | 79 DISALLOW_COPY_AND_ASSIGN(Sequence); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace internal | 82 } // namespace internal |
| 83 } // namespace base | 83 } // namespace base |
| 84 | 84 |
| 85 #endif // BASE_TASK_SCHEDULER_SEQUENCE_H_ | 85 #endif // BASE_TASK_SCHEDULER_SEQUENCE_H_ |
| OLD | NEW |