summaryrefslogtreecommitdiffstats
path: root/base/file_util_proxy.h
diff options
context:
space:
mode:
authordumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 22:09:30 +0000
committerdumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 22:09:30 +0000
commitb51f7bf9a501c5d2e62e3d33de109518b18fd0d2 (patch)
treed712d46ff7e7ccf807339131cf170a622c2a98ff /base/file_util_proxy.h
parentcaede4f6637e211c7c2470691dd27010832a614e (diff)
downloadchromium_src-b51f7bf9a501c5d2e62e3d33de109518b18fd0d2.zip
chromium_src-b51f7bf9a501c5d2e62e3d33de109518b18fd0d2.tar.gz
chromium_src-b51f7bf9a501c5d2e62e3d33de109518b18fd0d2.tar.bz2
Adding some utility functions that work on file handles, and adding
the corresponding relays to file_util_proxy. BUG=none TEST=none Review URL: http://codereview.chromium.org/3303007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_proxy.h')
-rw-r--r--base/file_util_proxy.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/base/file_util_proxy.h b/base/file_util_proxy.h
index 929dcd7..581738d 100644
--- a/base/file_util_proxy.h
+++ b/base/file_util_proxy.h
@@ -72,6 +72,11 @@ class FileUtilProxy {
const FilePath& file_path,
GetFileInfoCallback* callback);
+ static bool GetFileInfoFromPlatformFile(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ base::PlatformFile file,
+ GetFileInfoCallback* callback);
+
typedef Callback2<base::PlatformFileError /* error code */,
const std::vector<base::file_util_proxy::Entry>&
>::Type ReadDirectoryCallback;
@@ -119,6 +124,52 @@ class FileUtilProxy {
const FilePath& file_path,
StatusCallback* callback);
+ // Reads from a file. On success, the file pointer is moved to position
+ // |offset + bytes_to_read| in the file. The callback can be NULL.
+ typedef Callback2<base::PlatformFileError /* error code */,
+ int /* bytes read/written */>::Type ReadWriteCallback;
+ static bool Read(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ base::PlatformFile file,
+ int64 offset,
+ char* buffer,
+ int bytes_to_read,
+ ReadWriteCallback* callback);
+
+ // Writes to a file. If |offset| is greater than the length of the file,
+ // |false| is returned. On success, the file pointer is moved to position
+ // |offset + bytes_to_write| in the file. If The callback can be NULL.
+ static bool Write(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ base::PlatformFile file,
+ int64 offset,
+ const char* buffer,
+ int bytes_to_write,
+ ReadWriteCallback* callback);
+
+ // Touches a file. The callback can be NULL.
+ static bool Touch(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ base::PlatformFile file,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ StatusCallback* callback);
+
+ // Truncates a file to the given length. If |length| is greater than the
+ // current length of the file, the file will be extended with zeroes.
+ // The callback can be NULL.
+ static bool Truncate(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ base::PlatformFile file,
+ long long length,
+ StatusCallback* callback);
+
+ // Flushes a file. The callback can be NULL.
+ static bool Flush(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ base::PlatformFile file,
+ StatusCallback* callback);
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy);
};