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

Unified Diff: base/file_util_proxy.cc

Issue 7066067: Support creating temporary files for sync file operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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: base/file_util_proxy.cc
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
index 1d5b9cc3cea8ca3b11d232c2a10f87b5c5dba582..4dd57b792caf3ff65e45b8d830bd1e3a9bd6e534 100644
--- a/base/file_util_proxy.cc
+++ b/base/file_util_proxy.cc
@@ -167,8 +167,10 @@ class RelayCreateTemporary : public MessageLoopRelay {
public:
RelayCreateTemporary(
scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
+ bool async,
base::FileUtilProxy::CreateTemporaryCallback* callback)
: message_loop_proxy_(message_loop_proxy),
+ async_(async),
callback_(callback),
file_handle_(base::kInvalidPlatformFileValue) {
DCHECK(callback);
@@ -190,8 +192,10 @@ class RelayCreateTemporary : public MessageLoopRelay {
int file_flags =
base::PLATFORM_FILE_CREATE_ALWAYS |
base::PLATFORM_FILE_WRITE |
- base::PLATFORM_FILE_ASYNC |
base::PLATFORM_FILE_TEMPORARY;
+ if (async_) {
+ file_flags |= base::PLATFORM_FILE_ASYNC;
+ }
base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
file_handle_ = base::CreatePlatformFile(file_path_, file_flags,
NULL, &error_code);
@@ -206,6 +210,7 @@ class RelayCreateTemporary : public MessageLoopRelay {
private:
scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+ bool async_;
base::FileUtilProxy::CreateTemporaryCallback* callback_;
base::PlatformFile file_handle_;
FilePath file_path_;
@@ -742,9 +747,10 @@ bool FileUtilProxy::CreateOrOpen(
// static
bool FileUtilProxy::CreateTemporary(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ bool async,
CreateTemporaryCallback* callback) {
return Start(FROM_HERE, message_loop_proxy,
- new RelayCreateTemporary(message_loop_proxy, callback));
+ new RelayCreateTemporary(message_loop_proxy, async, callback));
}
// static

Powered by Google App Engine
This is Rietveld 408576698