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

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: base/threading/sequenced_worker_pool.cc
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc
index 6f4a248aaf6cd2a0492f45c3647258f05c20fc31..3f484ebd727203901e0691fd02c3490823ae53fa 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -17,11 +17,11 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
-#include "base/message_loop/message_loop_proxy.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
+#include "base/thread_task_runner_handle.h"
#include "base/threading/platform_thread.h"
#include "base/threading/simple_thread.h"
#include "base/threading/thread_local.h"
@@ -1158,29 +1158,29 @@ SequencedWorkerPool::GetSequenceTokenForCurrentThread() {
return *token;
}
-SequencedWorkerPool::SequencedWorkerPool(
- size_t max_threads,
- const std::string& thread_name_prefix)
- : constructor_message_loop_(MessageLoopProxy::current()),
+// Note: the task runner is unset when SequencedWorkerPool is constructed
danakj 2015/04/21 20:16:31 Uhm.. I'm not sure what this comment means. Can yo
Sami 2015/04/23 17:48:25 Oh, sorry, accidentally left this in since I initi
+// between unit tests after MessageLoop destruction.
+SequencedWorkerPool::SequencedWorkerPool(size_t max_threads,
+ const std::string& thread_name_prefix)
+ : constructor_task_runner_(ThreadTaskRunnerHandle::Get()),
inner_(new Inner(this, max_threads, thread_name_prefix, NULL)) {
}
-SequencedWorkerPool::SequencedWorkerPool(
- size_t max_threads,
- const std::string& thread_name_prefix,
- TestingObserver* observer)
- : constructor_message_loop_(MessageLoopProxy::current()),
+SequencedWorkerPool::SequencedWorkerPool(size_t max_threads,
+ const std::string& thread_name_prefix,
+ TestingObserver* observer)
+ : constructor_task_runner_(ThreadTaskRunnerHandle::Get()),
inner_(new Inner(this, max_threads, thread_name_prefix, observer)) {
}
SequencedWorkerPool::~SequencedWorkerPool() {}
void SequencedWorkerPool::OnDestruct() const {
- DCHECK(constructor_message_loop_.get());
+ DCHECK(constructor_task_runner_.get());
danakj 2015/04/21 20:16:31 nit: no .get()
Sami 2015/04/23 17:48:25 Done.
// Avoid deleting ourselves on a worker thread (which would
// deadlock).
if (RunsTasksOnCurrentThread()) {
- constructor_message_loop_->DeleteSoon(FROM_HERE, this);
+ constructor_task_runner_->DeleteSoon(FROM_HERE, this);
} else {
delete this;
}
@@ -1300,7 +1300,7 @@ void SequencedWorkerPool::SignalHasWorkForTesting() {
}
void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) {
- DCHECK(constructor_message_loop_->BelongsToCurrentThread());
+ DCHECK(constructor_task_runner_->BelongsToCurrentThread());
inner_->Shutdown(max_new_blocking_tasks_after_shutdown);
}

Powered by Google App Engine
This is Rietveld 408576698