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

Unified Diff: base/file_util_proxy.cc

Issue 3380024: Adding a FileUtilProxy::TouchFile() method that takes a FilePath as an... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | « base/file_util_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_proxy.cc
===================================================================
--- base/file_util_proxy.cc (revision 60236)
+++ base/file_util_proxy.cc (working copy)
@@ -557,6 +557,31 @@
base::Time last_modified_time_;
};
+class RelayTouchFilePath : public RelayWithStatusCallback {
+ public:
+ RelayTouchFilePath(const FilePath& file_path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ base::FileUtilProxy::StatusCallback* callback)
+ : RelayWithStatusCallback(callback),
+ file_path_(file_path_),
+ last_access_time_(last_access_time),
+ last_modified_time_(last_modified_time) {
+ }
+
+ protected:
+ virtual void RunWork() {
+ if (!file_util::TouchFile(
+ file_path_, last_access_time_, last_modified_time_))
+ set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
+ }
+
+ private:
+ FilePath file_path_;
+ base::Time last_access_time_;
+ base::Time last_modified_time_;
+};
+
class RelayTruncate : public RelayWithStatusCallback {
public:
RelayTruncate(base::PlatformFile file,
@@ -742,6 +767,18 @@
}
// static
+bool FileUtilProxy::Touch(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ const FilePath& file_path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ StatusCallback* callback) {
+ return Start(FROM_HERE, message_loop_proxy,
+ new RelayTouchFilePath(file_path, last_access_time,
+ last_modified_time, callback));
+}
+
+// static
bool FileUtilProxy::Truncate(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
PlatformFile file,
« no previous file with comments | « base/file_util_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698