Skip to content

Commit

Permalink
Remove CreateAndOpenTemporaryShmemFile().
Browse files Browse the repository at this point in the history
It had exactly one use.

R=brettw@chromium.org

Review URL: https://codereview.chromium.org/205273004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258414 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
viettrungluu@chromium.org committed Mar 20, 2014
1 parent 82a4946 commit 271b8da
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
6 changes: 0 additions & 6 deletions base/file_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,6 @@ BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type);
// you intend to create executable shmem segments so this function can find
// an appropriate location.
BASE_EXPORT bool GetShmemTempDir(bool executable, FilePath* path);

// Like above but for shmem files. Only useful for POSIX.
// The executable flag says the file needs to support using
// mprotect with PROT_EXEC after mapping.
BASE_EXPORT FILE* CreateAndOpenTemporaryShmemFile(FilePath* path,
bool executable);
#endif

} // namespace base
Expand Down
4 changes: 0 additions & 4 deletions base/file_util_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,4 @@ FilePath GetHomeDir() {
return FilePath("/tmp");
}

bool GetShmemTempDir(bool executable, base::FilePath* path) {
return GetTempDir(path);
}

} // namespace base
15 changes: 3 additions & 12 deletions base/file_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,8 @@ 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.
#if !defined(OS_ANDROID)
// This is implemented in file_util_android.cc for that platform.
bool GetShmemTempDir(bool executable, FilePath* path) {
#if defined(OS_LINUX)
bool use_dev_shm = true;
Expand All @@ -837,15 +836,7 @@ bool GetShmemTempDir(bool executable, FilePath* path) {
#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);
}
#endif // !defined(OS_ANDROID)

// -----------------------------------------------------------------------------

Expand Down
4 changes: 3 additions & 1 deletion base/memory/shared_memory_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ bool SharedMemory::Create(const SharedMemoryCreateOptions& options) {
DCHECK(!options.open_existing_deprecated);
// Q: Why not use the shm_open() etc. APIs?
// A: Because they're limited to 4mb on OS X. FFFFFFFUUUUUUUUUUU
fp.reset(base::CreateAndOpenTemporaryShmemFile(&path, options.executable));
FilePath directory;
if (GetShmemTempDir(options.executable, &directory))
fp.reset(CreateAndOpenTemporaryFileInDir(directory, &path));

if (fp) {
// Also open as readonly so that we can ShareReadOnlyToProcess.
Expand Down

0 comments on commit 271b8da

Please sign in to comment.