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

Unified Diff: chrome/browser/net/connection_tester.cc

Issue 8589012: base::Bind fixes (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
Index: chrome/browser/net/connection_tester.cc
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 2425dddfa5dd3394fa83a0803d6f0a9bae95243a..ba7262bcabdbb5486e2d353e682a55cab06b12c6 100644
--- a/chrome/browser/net/connection_tester.cc
+++ b/chrome/browser/net/connection_tester.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/net/connection_tester.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
@@ -262,7 +263,7 @@ class ConnectionTester::TestRunner : public net::URLRequest::Delegate {
// |tester| will be notified of completion.
explicit TestRunner(ConnectionTester* tester)
: tester_(tester),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {}
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {}
// Starts running |experiment|. Notifies tester->OnExperimentCompleted() when
// it is done.
@@ -288,7 +289,7 @@ class ConnectionTester::TestRunner : public net::URLRequest::Delegate {
ConnectionTester* tester_;
scoped_ptr<net::URLRequest> request_;
- ScopedRunnableMethodFactory<TestRunner> method_factory_;
+ base::WeakPtrFactory<TestRunner> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TestRunner);
};
@@ -340,8 +341,8 @@ void ConnectionTester::TestRunner::OnResponseCompleted(
// to end up deleting the URLRequest while in the middle of processing).
MessageLoop::current()->PostTask(
FROM_HERE,
- method_factory_.NewRunnableMethod(
- &TestRunner::OnExperimentCompletedWithResult, result));
+ base::Bind(&TestRunner::OnExperimentCompletedWithResult,
+ weak_factory_.GetWeakPtr(), result));
}
void ConnectionTester::TestRunner::OnExperimentCompletedWithResult(int result) {

Powered by Google App Engine
This is Rietveld 408576698