summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-29 01:16:17 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-29 01:16:17 +0000
commit4e2dec35b853165a371bef6bee55885af75158fa (patch)
treed6bbdca3808e46f99fe0e5c7b0353e94f3a79804 /content
parent3788a74e495d05b87548d9bd4dbb667531f17495 (diff)
downloadchromium_src-4e2dec35b853165a371bef6bee55885af75158fa.zip
chromium_src-4e2dec35b853165a371bef6bee55885af75158fa.tar.gz
chromium_src-4e2dec35b853165a371bef6bee55885af75158fa.tar.bz2
Migrate CreateTemporaryFileStream to use FileProxy
BUG=322664 Review URL: https://codereview.chromium.org/232483003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266727 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/loader/temporary_file_stream.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/content/browser/loader/temporary_file_stream.cc b/content/browser/loader/temporary_file_stream.cc
index 5979bd9..b2e0316 100644
--- a/content/browser/loader/temporary_file_stream.cc
+++ b/content/browser/loader/temporary_file_stream.cc
@@ -6,7 +6,7 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/files/file_util_proxy.h"
+#include "base/files/file_proxy.h"
#include "base/memory/ref_counted.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/file_stream.h"
@@ -20,12 +20,12 @@ namespace {
void DidCreateTemporaryFile(
const CreateTemporaryFileStreamCallback& callback,
+ scoped_ptr<base::FileProxy> file_proxy,
base::File::Error error_code,
- base::PassPlatformFile file_handle,
const base::FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (error_code != base::File::FILE_OK) {
+ if (!file_proxy->IsValid()) {
callback.Run(error_code, scoped_ptr<net::FileStream>(), NULL);
return;
}
@@ -38,9 +38,8 @@ void DidCreateTemporaryFile(
BrowserThread::GetMessageLoopProxyForThread(
BrowserThread::FILE).get());
- scoped_ptr<net::FileStream> file_stream(new net::FileStream(
- file_handle.ReleaseValue(),
- base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC));
+ scoped_ptr<net::FileStream> file_stream(
+ new net::FileStream(file_proxy->TakeFile()));
callback.Run(error_code, file_stream.Pass(), deletable_file);
}
@@ -51,10 +50,12 @@ void CreateTemporaryFileStream(
const CreateTemporaryFileStreamCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- base::FileUtilProxy::CreateTemporary(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
- base::PLATFORM_FILE_ASYNC,
- base::Bind(&DidCreateTemporaryFile, callback));
+ scoped_ptr<base::FileProxy> file_proxy(new base::FileProxy(
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get()));
+ base::FileProxy* proxy = file_proxy.get();
+ proxy->CreateTemporary(
+ base::File::FLAG_ASYNC,
+ base::Bind(&DidCreateTemporaryFile, callback, Passed(&file_proxy)));
}
} // namespace content