Index: base/task_scheduler/scheduler_worker_stack.h |
diff --git a/base/task_scheduler/scheduler_worker_stack.h b/base/task_scheduler/scheduler_worker_stack.h |
index 1d1748ca10520a7a39b626268edec3f81a97ff01..649a629e664234a507770d0808f0fc7cf4bc597e 100644 |
--- a/base/task_scheduler/scheduler_worker_stack.h |
+++ b/base/task_scheduler/scheduler_worker_stack.h |
@@ -17,11 +17,11 @@ namespace internal { |
class SchedulerWorker; |
-// A stack of SchedulerWorkers. Supports removal of arbitrary |
-// SchedulerWorkers. DCHECKs when a SchedulerWorker is inserted |
-// multiple times. SchedulerWorkers are not owned by the stack. Push() is |
-// amortized O(1). Pop(), Size() and Empty() are O(1). Remove is O(n). This |
-// class is NOT thread-safe. |
+// A stack of SchedulerWorkers. Supports removal of arbitrary SchedulerWorkers. |
+// DCHECKs when a SchedulerWorker is inserted multiple times. SchedulerWorkers |
+// are not owned by the stack. Push() is amortized O(1). Pop(), Peek(), Size() |
+// and Empty() are O(1). Contains() and Remove() are O(n). |
+// This class is NOT thread-safe. |
class BASE_EXPORT SchedulerWorkerStack { |
public: |
SchedulerWorkerStack(); |
@@ -35,6 +35,13 @@ class BASE_EXPORT SchedulerWorkerStack { |
// Returns nullptr if the stack is empty. |
SchedulerWorker* Pop(); |
+ // Removes the top SchedulerWorker from the stack and returns it. |
+ // Returns nullptr if the stack is empty. |
+ SchedulerWorker* Peek() const; |
+ |
+ // Returns true if |worker| is already on the stack. |
+ bool Contains(const SchedulerWorker* worker) const; |
+ |
// Removes |worker| from the stack. |
void Remove(const SchedulerWorker* worker); |