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

Unified Diff: base/threading/thread.cc

Issue 8653006: Remove custom Task implementations in base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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/threading/thread.h ('k') | base/threading/thread_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread.cc
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index 076580df1e314d67ded7253dfd170c2c09e0117d..7188e9f08347f0842261f8e5c83ad769abd4a784 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -4,6 +4,7 @@
#include "base/threading/thread.h"
+#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/thread_local.h"
@@ -22,14 +23,11 @@ base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool =
} // namespace
-// This task is used to trigger the message loop to exit.
-class ThreadQuitTask : public Task {
- public:
- virtual void Run() {
- MessageLoop::current()->Quit();
- Thread::SetThreadWasQuitProperly(true);
- }
-};
+// This is used to trigger the message loop to exit.
+void ThreadQuitHelper() {
+ MessageLoop::current()->Quit();
+ Thread::SetThreadWasQuitProperly(true);
+}
// Used to pass data to ThreadMain. This structure is allocated on the stack
// from within StartWithOptions.
@@ -121,7 +119,7 @@ void Thread::StopSoon() {
return;
stopping_ = true;
- message_loop_->PostTask(FROM_HERE, new ThreadQuitTask());
+ message_loop_->PostTask(FROM_HERE, base::Bind(&ThreadQuitHelper));
}
void Thread::Run(MessageLoop* message_loop) {
@@ -165,7 +163,7 @@ void Thread::ThreadMain() {
// Let the thread do extra cleanup.
CleanUp();
- // Assert that MessageLoop::Quit was called by ThreadQuitTask.
+ // Assert that MessageLoop::Quit was called by ThreadQuitHelper.
DCHECK(GetThreadWasQuitProperly());
// We can't receive messages anymore.
« no previous file with comments | « base/threading/thread.h ('k') | base/threading/thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698