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

Side by Side Diff: base/file_util_proxy.h

Issue 7066067: Support creating temporary files for sync file operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Darin's comments Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_FILE_UTIL_PROXY_H_ 5 #ifndef BASE_FILE_UTIL_PROXY_H_
6 #define BASE_FILE_UTIL_PROXY_H_ 6 #define BASE_FILE_UTIL_PROXY_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base_api.h" 10 #include "base/base_api.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // for the callback. 57 // for the callback.
58 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create 58 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create
59 // a new file at the given |file_path| and calls back with 59 // a new file at the given |file_path| and calls back with
60 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. 60 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists.
61 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy, 61 static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy,
62 const FilePath& file_path, 62 const FilePath& file_path,
63 int file_flags, 63 int file_flags,
64 CreateOrOpenCallback* callback); 64 CreateOrOpenCallback* callback);
65 65
66 // Creates a temporary file for writing. The path and an open file handle 66 // Creates a temporary file for writing. The path and an open file handle
67 // are returned. It is invalid to pass NULL for the callback. 67 // are returned. It is invalid to pass NULL for the callback. The additional
68 // file flags will be added on top of the default file flags which are:
69 // base::PLATFORM_FILE_CREATE_ALWAYS
70 // base::PLATFORM_FILE_WRITE
71 // base::PLATFORM_FILE_TEMPORARY.
72 // Set |additional_file_flags| to 0 for synchronous writes and set to
73 // base::PLATFORM_FILE_ASYNC to support asynchronous file operations.
68 static bool CreateTemporary( 74 static bool CreateTemporary(
69 scoped_refptr<MessageLoopProxy> message_loop_proxy, 75 scoped_refptr<MessageLoopProxy> message_loop_proxy,
76 int additional_file_flags,
70 CreateTemporaryCallback* callback); 77 CreateTemporaryCallback* callback);
71 78
72 // Close the given file handle. 79 // Close the given file handle.
73 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, 80 static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy,
74 PlatformFile, 81 PlatformFile,
75 StatusCallback* callback); 82 StatusCallback* callback);
76 83
77 // Ensures that the given |file_path| exist. This creates a empty new file 84 // Ensures that the given |file_path| exist. This creates a empty new file
78 // at |file_path| if the |file_path| does not exist. 85 // at |file_path| if the |file_path| does not exist.
79 // If a new file han not existed and is created at the |file_path|, 86 // If a new file han not existed and is created at the |file_path|,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 PlatformFile file, 214 PlatformFile file,
208 StatusCallback* callback); 215 StatusCallback* callback);
209 216
210 private: 217 private:
211 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); 218 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy);
212 }; 219 };
213 220
214 } // namespace base 221 } // namespace base
215 222
216 #endif // BASE_FILE_UTIL_PROXY_H_ 223 #endif // BASE_FILE_UTIL_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698