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

Unified Diff: base/file_util_posix.cc

Issue 204683002: Make the shmem-specific functions in file_util.h POSIX-only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « base/file_util.h ('k') | base/file_util_unittest.cc » ('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 fb4ebcfcb843dc5cc31a7f0241ba95034cb107d1..0879510b202241111b985d2fcfe95a5147769bae 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -463,25 +463,6 @@ bool GetTempDir(FilePath* path) {
}
#endif // !defined(OS_MACOSX)
-#if !defined(OS_MACOSX) && !defined(OS_ANDROID)
-// This is implemented in file_util_mac.mm and file_util_android.cc for those
-// platforms.
-bool GetShmemTempDir(bool executable, FilePath* path) {
-#if defined(OS_LINUX)
- bool use_dev_shm = true;
- if (executable) {
- static const bool s_dev_shm_executable = DetermineDevShmExecutable();
- use_dev_shm = s_dev_shm_executable;
- }
- if (use_dev_shm) {
- *path = FilePath("/dev/shm");
- return true;
- }
-#endif
- return GetTempDir(path);
-}
-#endif // !defined(OS_MACOSX) && !defined(OS_ANDROID)
-
#if !defined(OS_MACOSX) // Mac implementation is in file_util_mac.mm.
FilePath GetHomeDir() {
#if defined(OS_CHROMEOS)
@@ -528,14 +509,6 @@ bool CreateTemporaryFile(FilePath* path) {
return true;
}
-FILE* CreateAndOpenTemporaryShmemFile(FilePath* path, bool executable) {
- FilePath directory;
- if (!GetShmemTempDir(executable, &directory))
- return NULL;
-
- return CreateAndOpenTemporaryFileInDir(directory, path);
-}
-
FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) {
int fd = CreateAndOpenFdForTemporaryFile(dir, path);
if (fd < 0)
@@ -847,6 +820,33 @@ int GetMaximumPathComponentLength(const FilePath& path) {
return pathconf(path.value().c_str(), _PC_NAME_MAX);
}
+#if !defined(OS_MACOSX) && !defined(OS_ANDROID)
+// This is implemented in file_util_mac.mm and file_util_android.cc for those
+// platforms.
+bool GetShmemTempDir(bool executable, FilePath* path) {
+#if defined(OS_LINUX)
+ bool use_dev_shm = true;
+ if (executable) {
+ static const bool s_dev_shm_executable = DetermineDevShmExecutable();
+ use_dev_shm = s_dev_shm_executable;
+ }
+ if (use_dev_shm) {
+ *path = FilePath("/dev/shm");
+ return true;
+ }
+#endif
+ return GetTempDir(path);
+}
+#endif // !defined(OS_MACOSX) && !defined(OS_ANDROID)
+
+FILE* CreateAndOpenTemporaryShmemFile(FilePath* path, bool executable) {
+ FilePath directory;
+ if (!GetShmemTempDir(executable, &directory))
+ return NULL;
+
+ return CreateAndOpenTemporaryFileInDir(directory, path);
+}
+
// -----------------------------------------------------------------------------
namespace internal {
« no previous file with comments | « base/file_util.h ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698