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

Unified Diff: chrome/browser/ui/webui/chrome_url_data_manager_backend.cc

Issue 8113025: base::Bind: More converts, mostly in WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years, 2 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: chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
index f205f31e545d24c7e4b208e53261c908f845b07f..3f018ec31ef1671a05c79e6a81a11207f84280df 100644
--- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
+++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
@@ -5,10 +5,12 @@
#include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
#include "base/basictypes.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/memory/ref_counted_memory.h"
+#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
@@ -114,7 +116,7 @@ class URLRequestChromeJob : public net::URLRequestJob {
// The backend is owned by ChromeURLRequestContext and always outlives us.
ChromeURLDataManagerBackend* backend_;
- ScopedRunnableMethodFactory<URLRequestChromeJob> method_factory_;
+ base::WeakPtrFactory<URLRequestChromeJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(URLRequestChromeJob);
};
@@ -125,7 +127,7 @@ URLRequestChromeJob::URLRequestChromeJob(net::URLRequest* request,
data_offset_(0),
pending_buf_size_(0),
backend_(backend),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
DCHECK(backend);
}
@@ -136,8 +138,10 @@ URLRequestChromeJob::~URLRequestChromeJob() {
void URLRequestChromeJob::Start() {
// Start reading asynchronously so that all error reporting and data
// callbacks happen as they would for network requests.
- MessageLoop::current()->PostTask(FROM_HERE, method_factory_.NewRunnableMethod(
- &URLRequestChromeJob::StartAsync));
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&URLRequestChromeJob::StartAsync,
+ weak_factory_.GetWeakPtr()));
}
void URLRequestChromeJob::Kill() {
@@ -367,9 +371,8 @@ bool ChromeURLDataManagerBackend::StartRequest(const GURL& url,
// usually the UI thread, for this path.
target_message_loop->PostTask(
FROM_HERE,
- NewRunnableMethod(source,
- &ChromeURLDataManager::DataSource::StartDataRequest,
- path, context->is_incognito(), request_id));
+ base::Bind(&ChromeURLDataManager::DataSource::StartDataRequest, source,
+ path, context->is_incognito(), request_id));
}
return true;
}
« no previous file with comments | « chrome/browser/ui/webui/chrome_url_data_manager.cc ('k') | chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698