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

Unified Diff: webkit/fileapi/file_system_url_request_job.cc

Issue 8231004: Remaining cleanup (base::Bind): Replacing FileUtilProxy calls with new callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got it building 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: webkit/fileapi/file_system_url_request_job.cc
diff --git a/webkit/fileapi/file_system_url_request_job.cc b/webkit/fileapi/file_system_url_request_job.cc
index 34fec217c7057fbfdadca4b958add24ca597d6b8..30966fbda6d8e6fdbe0842b9bf6d553f8a9516d6 100644
--- a/webkit/fileapi/file_system_url_request_job.cc
+++ b/webkit/fileapi/file_system_url_request_job.cc
@@ -4,6 +4,7 @@
#include "webkit/fileapi/file_system_url_request_job.h"
+#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/file_util_proxy.h"
@@ -105,8 +106,7 @@ FileSystemURLRequestJob::FileSystemURLRequestJob(
: URLRequestJob(request),
file_system_context_(file_system_context),
file_thread_proxy_(file_thread_proxy),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
- ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(
io_callback_(this, &FileSystemURLRequestJob::DidRead)),
stream_(NULL),
@@ -122,9 +122,10 @@ FileSystemURLRequestJob::~FileSystemURLRequestJob() {
}
void FileSystemURLRequestJob::Start() {
- MessageLoop::current()->PostTask(FROM_HERE,
- method_factory_.NewRunnableMethod(
- &FileSystemURLRequestJob::StartAsync));
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&FileSystemURLRequestJob::StartAsync,
+ weak_factory_.GetWeakPtr()));
}
void FileSystemURLRequestJob::Kill() {
@@ -133,8 +134,7 @@ void FileSystemURLRequestJob::Kill() {
stream_.reset(NULL);
}
URLRequestJob::Kill();
- method_factory_.RevokeAll();
- callback_factory_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
}
bool FileSystemURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size,
@@ -238,7 +238,8 @@ void FileSystemURLRequestJob::DidGetMetadata(
if (!is_directory_) {
base::FileUtilProxy::CreateOrOpen(
file_thread_proxy_, platform_path, kFileFlags,
- callback_factory_.NewCallback(&FileSystemURLRequestJob::DidOpen));
+ base::Bind(&FileSystemURLRequestJob::DidOpen,
+ weak_factory_.GetWeakPtr()));
} else {
NotifyHeadersComplete();
}

Powered by Google App Engine
This is Rietveld 408576698