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

Unified Diff: base/file_util_posix.cc

Issue 203873002: Base: Make file_util and file use the same code to translate from stat to File::Info (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove TODO Created 6 years, 9 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 | « no previous file | base/files/file.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 03afea7214cf9f2e799bcca7f16730625bf7cc32..e2eb2f89ac09464bdb817c9798740b2979d149d3 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -61,8 +61,7 @@ namespace base {
namespace {
-#if defined(OS_BSD) || defined(OS_MACOSX)
-typedef struct stat stat_wrapper_t;
+#if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL)
static int CallStat(const char *path, stat_wrapper_t *sb) {
ThreadRestrictions::AssertIOAllowed();
return stat(path, sb);
@@ -71,8 +70,7 @@ static int CallLstat(const char *path, stat_wrapper_t *sb) {
ThreadRestrictions::AssertIOAllowed();
return lstat(path, sb);
}
-#else // defined(OS_BSD) || defined(OS_MACOSX)
-typedef struct stat64 stat_wrapper_t;
+#else // defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL)
static int CallStat(const char *path, stat_wrapper_t *sb) {
ThreadRestrictions::AssertIOAllowed();
return stat64(path, sb);
@@ -81,7 +79,7 @@ static int CallLstat(const char *path, stat_wrapper_t *sb) {
ThreadRestrictions::AssertIOAllowed();
return lstat64(path, sb);
}
-#endif // !(defined(OS_BSD) || defined(OS_MACOSX))
+#endif // !(defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL))
// Helper for NormalizeFilePath(), defined below.
bool RealPath(const FilePath& path, FilePath* real_path) {
@@ -639,21 +637,8 @@ bool GetFileInfo(const FilePath& file_path, File::Info* results) {
#if defined(OS_ANDROID)
}
#endif // defined(OS_ANDROID)
- results->is_directory = S_ISDIR(file_info.st_mode);
- results->size = file_info.st_size;
-#if defined(OS_MACOSX) || (defined(OS_FREEBSD) && __FreeBSD_version < 900000)
- results->last_modified = Time::FromTimeSpec(file_info.st_mtimespec);
- results->last_accessed = Time::FromTimeSpec(file_info.st_atimespec);
- results->creation_time = Time::FromTimeSpec(file_info.st_ctimespec);
-#elif defined(OS_ANDROID)
- results->last_modified = Time::FromTimeT(file_info.st_mtime);
- results->last_accessed = Time::FromTimeT(file_info.st_atime);
- results->creation_time = Time::FromTimeT(file_info.st_ctime);
-#else
- results->last_modified = Time::FromTimeSpec(file_info.st_mtim);
- results->last_accessed = Time::FromTimeSpec(file_info.st_atim);
- results->creation_time = Time::FromTimeSpec(file_info.st_ctim);
-#endif
+
+ results->FromStat(file_info);
return true;
}
« no previous file with comments | « no previous file | base/files/file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698