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

Unified Diff: content/common/net/url_fetcher.cc

Issue 8315011: base::Bind: Convert FileUtilProxy::CreateTemporaryCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Newfangled pipelining. 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
« no previous file with comments | « content/browser/renderer_host/redirect_to_file_resource_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/net/url_fetcher.cc
diff --git a/content/common/net/url_fetcher.cc b/content/common/net/url_fetcher.cc
index b9e1ff7c830470823aa4e066d0aaa76973ea92ec..13332af7b1687110e77f3fb70f9d8164e50153e9 100644
--- a/content/common/net/url_fetcher.cc
+++ b/content/common/net/url_fetcher.cc
@@ -6,12 +6,14 @@
#include <set>
+#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/file_util_proxy.h"
#include "base/lazy_instance.h"
#include "base/memory/scoped_callback_factory.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/message_loop_proxy.h"
#include "base/platform_file.h"
#include "base/stl_util.h"
@@ -149,6 +151,7 @@ class URLFetcher::Core
// Callbacks are created for use with base::FileUtilProxy.
base::ScopedCallbackFactory<URLFetcher::Core::TempFileWriter>
callback_factory_;
+ base::WeakPtrFactory<URLFetcher::Core::TempFileWriter> weak_factory_;
// Message loop on which file opperations should happen.
scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy_;
@@ -321,7 +324,8 @@ URLFetcher::Core::TempFileWriter::TempFileWriter(
scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy)
: core_(core),
error_code_(base::PLATFORM_FILE_OK),
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
file_message_loop_proxy_(file_message_loop_proxy),
temp_file_handle_(base::kInvalidPlatformFileValue) {
}
@@ -336,8 +340,8 @@ void URLFetcher::Core::TempFileWriter::CreateTempFile() {
base::FileUtilProxy::CreateTemporary(
file_message_loop_proxy_,
0, // No additional file flags.
- callback_factory_.NewCallback(
- &URLFetcher::Core::TempFileWriter::DidCreateTempFile));
+ base::Bind(&URLFetcher::Core::TempFileWriter::DidCreateTempFile,
+ weak_factory_.GetWeakPtr()));
}
void URLFetcher::Core::TempFileWriter::DidCreateTempFile(
« no previous file with comments | « content/browser/renderer_host/redirect_to_file_resource_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698