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

Unified Diff: base/threading/thread_unittest.cc

Issue 9086002: base::Bind: Remove Task. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fix. Created 8 years, 12 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.cc ('k') | base/threading/worker_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_unittest.cc
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc
index 0444947d4bf491395e42af2797ca8bb97aac477b..9997a38412354ec8f90840ced24fc7fd88c8e456 100644
--- a/base/threading/thread_unittest.cc
+++ b/base/threading/thread_unittest.cc
@@ -105,21 +105,9 @@ class CapturingDestructionObserver : public MessageLoop::DestructionObserver {
};
// Task that adds a destruction observer to the current message loop.
-class RegisterDestructionObserver : public Task {
- public:
- explicit RegisterDestructionObserver(
- MessageLoop::DestructionObserver* observer)
- : observer_(observer) {
- }
-
- virtual void Run() {
- MessageLoop::current()->AddDestructionObserver(observer_);
- observer_ = NULL;
- }
-
- private:
- MessageLoop::DestructionObserver* observer_;
-};
+void RegisterDestructionObserver(MessageLoop::DestructionObserver* observer) {
+ MessageLoop::current()->AddDestructionObserver(observer);
+}
} // namespace
@@ -234,8 +222,8 @@ TEST_F(ThreadTest, CleanUp) {
// Register an observer that writes into |captured_events| once the
// thread's message loop is destroyed.
t.message_loop()->PostTask(
- FROM_HERE,
- new RegisterDestructionObserver(&loop_destruction_observer));
+ FROM_HERE, base::Bind(&RegisterDestructionObserver,
+ base::Unretained(&loop_destruction_observer)));
// Upon leaving this scope, the thread is deleted.
}
« no previous file with comments | « base/task.cc ('k') | base/threading/worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698