Chromium Code Reviews| Index: base/memory/shared_memory.h |
| diff --git a/base/memory/shared_memory.h b/base/memory/shared_memory.h |
| index 13238aabacb1fb4f6924f4bf9b596e9517952861..b7e5a050603d52fce8e41b513c13454b2e5c6be6 100644 |
| --- a/base/memory/shared_memory.h |
| +++ b/base/memory/shared_memory.h |
| @@ -32,10 +32,7 @@ class FilePath; |
| struct BASE_EXPORT SharedMemoryCreateOptions { |
| SharedMemoryCreateOptions(); |
| -#if defined(OS_MACOSX) && !defined(OS_IOS) |
| - // The type of OS primitive that should back the SharedMemory object. |
| - SharedMemoryHandle::Type type; |
| -#else |
| +#if !(defined(OS_MACOSX) && !defined(OS_IOS)) |
|
Avi (use Gerrit)
2016/04/09 00:13:40
OMG
Does iOS use this? Can we just say #if !defin
erikchen
2016/04/09 00:20:50
iOS still uses the POSIX implementation for shared
|
| // DEPRECATED (crbug.com/345734): |
| // If NULL, the object is anonymous. This pointer is owned by the caller |
| // and must live through the call to Create(). |
| @@ -47,7 +44,7 @@ struct BASE_EXPORT SharedMemoryCreateOptions { |
| // shared memory must not exist. This flag is meaningless unless |
| // name_deprecated is non-NULL. |
| bool open_existing_deprecated; |
| -#endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| +#endif // !(defined(OS_MACOSX) && !defined(OS_IOS)) |
| // Size of the shared memory object to be created. |
| // When opening an existing object, this has no effect. |
| @@ -102,7 +99,7 @@ class BASE_EXPORT SharedMemory { |
| // The caller is responsible for destroying the duplicated OS primitive. |
| static SharedMemoryHandle DuplicateHandle(const SharedMemoryHandle& handle); |
| -#if defined(OS_POSIX) |
| +#if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) |
| // This method requires that the SharedMemoryHandle is backed by a POSIX fd. |
| static int GetFdFromSharedMemoryHandle(const SharedMemoryHandle& handle); |
| #endif |
| @@ -123,16 +120,6 @@ class BASE_EXPORT SharedMemory { |
| // Returns true on success and false on failure. |
| bool CreateAndMapAnonymous(size_t size); |
| -#if defined(OS_MACOSX) && !defined(OS_IOS) |
| - // These two methods are analogs of CreateAndMapAnonymous and CreateAnonymous |
| - // that force the underlying OS primitive to be a POSIX fd. Do not add new |
| - // uses of these methods unless absolutely necessary, since constructing a |
| - // fd-backed SharedMemory object frequently takes 100ms+. |
| - // http://crbug.com/466437. |
| - bool CreateAndMapAnonymousPosix(size_t size); |
| - bool CreateAnonymousPosix(size_t size); |
| -#endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| - |
| // Creates an anonymous shared memory segment of size size. |
| // Returns true on success and false on failure. |
| bool CreateAnonymous(size_t size) { |
| @@ -257,12 +244,11 @@ class BASE_EXPORT SharedMemory { |
| } |
| private: |
| -#if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) |
| +#if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) && \ |
| + !(defined(OS_MACOSX) && !defined(OS_IOS)) |
| bool PrepareMapFile(ScopedFILE fp, ScopedFD readonly); |
| -#if !(defined(OS_MACOSX) && !defined(OS_IOS)) |
| bool FilePathForMemoryName(const std::string& mem_name, FilePath* path); |
| #endif |
| -#endif // defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) |
| enum ShareMode { |
| SHARE_READONLY, |
| SHARE_CURRENT_MODE, |
| @@ -282,10 +268,6 @@ class BASE_EXPORT SharedMemory { |
| // The OS primitive that backs the shared memory region. |
| SharedMemoryHandle shm_; |
| - // The mechanism by which the memory is mapped. Only valid if |memory_| is not |
| - // |nullptr|. |
| - SharedMemoryHandle::Type mapped_memory_mechanism_; |
| - |
| int readonly_mapped_file_; |
| #elif defined(OS_POSIX) |
| int mapped_file_; |