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

Unified Diff: base/task_scheduler/priority_queue.cc

Issue 1882293004: TaskScheduler: Remove wake up callback from PriorityQueue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@5c_noexit
Patch Set: CR robliao #3 (remove unnecessary comment) 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 | « base/task_scheduler/priority_queue.h ('k') | base/task_scheduler/priority_queue_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/priority_queue.cc
diff --git a/base/task_scheduler/priority_queue.cc b/base/task_scheduler/priority_queue.cc
index 55eaf74f0fec58f7232fe3be048d2be96fd0ab90..05a90b22f8d85d90bd958e8aa2de6247af4a86c0 100644
--- a/base/task_scheduler/priority_queue.cc
+++ b/base/task_scheduler/priority_queue.cc
@@ -23,20 +23,12 @@ PriorityQueue::SequenceAndSortKey::SequenceAndSortKey(
PriorityQueue::SequenceAndSortKey::~SequenceAndSortKey() = default;
PriorityQueue::Transaction::Transaction(PriorityQueue* outer_queue)
- : auto_lock_(new AutoSchedulerLock(outer_queue->container_lock_)),
- outer_queue_(outer_queue) {
+ : auto_lock_(outer_queue->container_lock_), outer_queue_(outer_queue) {
DCHECK(CalledOnValidThread());
}
PriorityQueue::Transaction::~Transaction() {
DCHECK(CalledOnValidThread());
-
- // Run the wake up callback once for each call to Push(). Perform this outside
- // the scope of PriorityQueue's lock to avoid imposing an unnecessary lock
- // dependency on the callback's destination.
- auto_lock_.reset();
- for (size_t i = 0; i < num_wake_ups_; ++i)
- outer_queue_->wake_up_callback_.Run();
}
void PriorityQueue::Transaction::Push(
@@ -44,16 +36,6 @@ void PriorityQueue::Transaction::Push(
DCHECK(CalledOnValidThread());
DCHECK(!sequence_and_sort_key->is_null());
- PushNoWakeUp(std::move(sequence_and_sort_key));
-
- ++num_wake_ups_;
-}
-
-void PriorityQueue::Transaction::PushNoWakeUp(
- std::unique_ptr<SequenceAndSortKey> sequence_and_sort_key) {
- DCHECK(CalledOnValidThread());
- DCHECK(!sequence_and_sort_key->is_null());
-
outer_queue_->container_.push(std::move(sequence_and_sort_key));
}
@@ -75,16 +57,10 @@ void PriorityQueue::Transaction::Pop() {
outer_queue_->container_.pop();
}
-PriorityQueue::PriorityQueue(const Closure& wake_up_callback)
- : wake_up_callback_(wake_up_callback) {
- DCHECK(!wake_up_callback_.is_null());
-}
+PriorityQueue::PriorityQueue() = default;
-PriorityQueue::PriorityQueue(const Closure& wake_up_callback,
- const PriorityQueue* predecessor_priority_queue)
- : container_lock_(&predecessor_priority_queue->container_lock_),
- wake_up_callback_(wake_up_callback) {
- DCHECK(!wake_up_callback_.is_null());
+PriorityQueue::PriorityQueue(const PriorityQueue* predecessor_priority_queue)
+ : container_lock_(&predecessor_priority_queue->container_lock_) {
DCHECK(predecessor_priority_queue);
}
« no previous file with comments | « base/task_scheduler/priority_queue.h ('k') | base/task_scheduler/priority_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698