diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 18:40:30 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 18:40:30 +0000 |
commit | 30c1eea51e20355f11cc37b1bf82ac11644ab2b8 (patch) | |
tree | b031284a67e6d1618427301c83cd2ff6106b645e /webkit/blob | |
parent | 35d5280876154e0dab2f472314e49dce2ced217b (diff) | |
download | chromium_src-30c1eea51e20355f11cc37b1bf82ac11644ab2b8.zip chromium_src-30c1eea51e20355f11cc37b1bf82ac11644ab2b8.tar.gz chromium_src-30c1eea51e20355f11cc37b1bf82ac11644ab2b8.tar.bz2 |
base::Bind: Convert FileUtilProxy::CreateOrOpenCallback.
BUG=none
TEST=none
R=csilv@chromium.org
Review URL: http://codereview.chromium.org/8311010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/blob')
-rw-r--r-- | webkit/blob/blob_url_request_job.cc | 6 | ||||
-rw-r--r-- | webkit/blob/blob_url_request_job.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/webkit/blob/blob_url_request_job.cc b/webkit/blob/blob_url_request_job.cc index a02096f..d70536a 100644 --- a/webkit/blob/blob_url_request_job.cc +++ b/webkit/blob/blob_url_request_job.cc @@ -52,7 +52,8 @@ BlobURLRequestJob::BlobURLRequestJob( BlobData* blob_data, base::MessageLoopProxy* file_thread_proxy) : net::URLRequestJob(request), - callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), + ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)), + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), blob_data_(blob_data), file_thread_proxy_(file_thread_proxy), item_index_(0), @@ -111,6 +112,7 @@ void BlobURLRequestJob::Kill() { net::URLRequestJob::Kill(); callback_factory_.RevokeAll(); + weak_factory_.InvalidateWeakPtrs(); method_factory_.RevokeAll(); } @@ -316,7 +318,7 @@ bool BlobURLRequestJob::DispatchReadFile(const BlobData::Item& item) { base::FileUtilProxy::CreateOrOpen( file_thread_proxy_, item.file_path(), kFileOpenFlags, - callback_factory_.NewCallback(&BlobURLRequestJob::DidOpen)); + base::Bind(&BlobURLRequestJob::DidOpen, weak_factory_.GetWeakPtr())); SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0)); return false; } diff --git a/webkit/blob/blob_url_request_job.h b/webkit/blob/blob_url_request_job.h index ff563b86..160dfac 100644 --- a/webkit/blob/blob_url_request_job.h +++ b/webkit/blob/blob_url_request_job.h @@ -8,6 +8,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" #include "base/platform_file.h" #include "base/task.h" #include "net/http/http_byte_range.h" @@ -69,6 +70,7 @@ class BlobURLRequestJob : public net::URLRequestJob { void DidRead(int result); base::ScopedCallbackFactory<BlobURLRequestJob> callback_factory_; + base::WeakPtrFactory<BlobURLRequestJob> weak_factory_; scoped_refptr<BlobData> blob_data_; scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; std::vector<int64> item_length_list_; |