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

Unified Diff: base/task_scheduler/priority_queue.h

Issue 1868673002: TaskScheduler: Add PriorityQueue::Transaction::PushNoWakeUp(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tasktracker2
Patch Set: rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/task_scheduler/priority_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/priority_queue.h
diff --git a/base/task_scheduler/priority_queue.h b/base/task_scheduler/priority_queue.h
index c87c2b751378b857a6ef0722578b339c8fd5011b..726c682b485f45471c5caa03b1f0a627fc8aecd3 100644
--- a/base/task_scheduler/priority_queue.h
+++ b/base/task_scheduler/priority_queue.h
@@ -56,9 +56,16 @@ class BASE_EXPORT PriorityQueue {
public:
~Transaction();
- // Inserts |sequence_and_sort_key| in the PriorityQueue.
+ // Inserts |sequence_and_sort_key| in the PriorityQueue. Each call to this
+ // method will result in one invocation of the wake up callback when the
+ // Transaction is destroyed.
void Push(std::unique_ptr<SequenceAndSortKey> sequence_and_sort_key);
+ // Inserts |sequence_and_sort_key| in the PriorityQueue without invoking the
+ // wake up callback.
+ void PushNoWakeUp(
+ std::unique_ptr<SequenceAndSortKey> sequence_and_sort_key);
+
// Returns the SequenceAndSortKey with the highest priority or a null
// SequenceAndSortKey if the PriorityQueue is empty. The reference becomes
// invalid the next time that a Sequence is popped from the PriorityQueue.
@@ -81,22 +88,23 @@ class BASE_EXPORT PriorityQueue {
PriorityQueue* const outer_queue_;
- // Number of times that Push() has been called on this Transaction.
- size_t num_pushed_sequences_ = 0;
+ // Number of times that the wake up callback should be invoked when this
+ // Transaction is destroyed.
+ size_t num_wake_ups_ = 0;
DISALLOW_COPY_AND_ASSIGN(Transaction);
};
- // |sequence_inserted_callback| is a non-null callback invoked when the
- // Transaction is done for each Push that was performed with the Transaction.
- explicit PriorityQueue(const Closure& sequence_inserted_callback);
+ // |wake_up_callback| is a non-null callback invoked when a Transaction is
+ // done for each call to Push() on the Transaction.
+ explicit PriorityQueue(const Closure& wake_up_callback);
- // |sequence_inserted_callback| is a non-null callback invoked when the
- // Transaction is done for each Push that was performed with the Transaction.
+ // |wake_up_callback| is a non-null callback invoked when a Transaction is
+ // done for each call to Push() on the Transaction.
// |predecessor_priority_queue| is a PriorityQueue for which a thread is
// allowed to have an active Transaction when it creates a Transaction for
// this PriorityQueue.
- PriorityQueue(const Closure& sequence_inserted_callback,
+ PriorityQueue(const Closure& wake_up_callback,
const PriorityQueue* predecessor_priority_queue);
~PriorityQueue();
@@ -124,7 +132,7 @@ class BASE_EXPORT PriorityQueue {
ContainerType container_;
- const Closure sequence_inserted_callback_;
+ const Closure wake_up_callback_;
// A null SequenceAndSortKey returned by Peek() when the PriorityQueue is
// empty.
« no previous file with comments | « no previous file | base/task_scheduler/priority_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698