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..b96fc5ac99c1106e2bab09a70397cbd0f1e0507d 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,12 @@ class BASE_EXPORT SchedulerWorkerStack { |
// Returns nullptr if the stack is empty. |
SchedulerWorker* Pop(); |
+ // Returns the top SchedulerWorker from the stack, nullptr if 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); |