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

Unified Diff: content/test/test_url_fetcher_factory.cc

Issue 8556001: Convert NewRunnableFunction/NewRunnableMethod calls to use base::Bind(). (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 | « content/shell/shell_browser_context.cc ('k') | content/worker/webworkerclient_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_url_fetcher_factory.cc
diff --git a/content/test/test_url_fetcher_factory.cc b/content/test/test_url_fetcher_factory.cc
index 2e0fbd43ac94aaad9328e845d853fa81a5c1c787..5a51c59cfc6a0116f99c9ea9cecded8e6f0899d2 100644
--- a/content/test/test_url_fetcher_factory.cc
+++ b/content/test/test_url_fetcher_factory.cc
@@ -6,7 +6,9 @@
#include <string>
+#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "content/common/net/url_fetcher_impl.h"
#include "content/public/common/url_fetcher_delegate.h"
@@ -232,7 +234,7 @@ class FakeURLFetcher : public TestURLFetcher {
content::URLFetcherDelegate* d,
const std::string& response_data, bool success)
: TestURLFetcher(0, url, d),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
set_status(net::URLRequestStatus(
success ? net::URLRequestStatus::SUCCESS :
net::URLRequestStatus::FAILED,
@@ -246,7 +248,7 @@ class FakeURLFetcher : public TestURLFetcher {
virtual void Start() OVERRIDE {
MessageLoop::current()->PostTask(
FROM_HERE,
- method_factory_.NewRunnableMethod(&FakeURLFetcher::RunDelegate));
+ base::Bind(&FakeURLFetcher::RunDelegate, weak_factory_.GetWeakPtr()));
}
virtual const GURL& GetURL() const OVERRIDE {
@@ -263,8 +265,7 @@ class FakeURLFetcher : public TestURLFetcher {
delegate()->OnURLFetchComplete(this);
}
- // Method factory used to run the delegate.
- ScopedRunnableMethodFactory<FakeURLFetcher> method_factory_;
+ base::WeakPtrFactory<FakeURLFetcher> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(FakeURLFetcher);
};
« no previous file with comments | « content/shell/shell_browser_context.cc ('k') | content/worker/webworkerclient_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698