| Index: base/memory/shared_memory.h
|
| diff --git a/base/memory/shared_memory.h b/base/memory/shared_memory.h
|
| index d76e01c6e57612024fe35dc7c430229d89cd5112..008bb0106688c56f66e7edea893de42b5c5c0f5a 100644
|
| --- a/base/memory/shared_memory.h
|
| +++ b/base/memory/shared_memory.h
|
| @@ -34,10 +34,7 @@ class FilePath;
|
| #if defined(OS_WIN)
|
| typedef HANDLE SharedMemoryHandle;
|
| #elif defined(OS_POSIX)
|
| -// A SharedMemoryId is sufficient to identify a given shared memory segment on a
|
| -// system, but insufficient to map it.
|
| typedef FileDescriptor SharedMemoryHandle;
|
| -typedef ino_t SharedMemoryId;
|
| #endif
|
|
|
| // Options for creating a shared memory object.
|
| @@ -116,6 +113,21 @@ class BASE_EXPORT SharedMemory {
|
| // Returns the maximum number of handles that can be open at once per process.
|
| static size_t GetHandleLimit();
|
|
|
| + // Duplicates The underlying OS primitive. Returns NULLHandle() on failure.
|
| + // The caller is responsible for destroying the duplicated OS primitive.
|
| + static SharedMemoryHandle DuplicateHandle(const SharedMemoryHandle& handle);
|
| +
|
| +#if defined(OS_POSIX)
|
| + // This method requires that the SharedMemoryHandle is backed by a POSIX fd.
|
| + static int GetFdFromSharedMemoryHandle(const SharedMemoryHandle& handle);
|
| +#endif
|
| +
|
| +#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
| + // Returns the size of the shared memory region referred to by |handle|.
|
| + // Returns '-1' on a failure to determine the size.
|
| + static int GetSizeFromSharedMemoryHandle(const SharedMemoryHandle& handle);
|
| +#endif // defined(OS_POSIX) && !defined(OS_ANDROID)
|
| +
|
| // Creates a shared memory object as described by the options struct.
|
| // Returns true on success and false on failure.
|
| bool Create(const SharedMemoryCreateOptions& options);
|
| @@ -192,14 +204,6 @@ class BASE_EXPORT SharedMemory {
|
| // identifier is not portable.
|
| SharedMemoryHandle handle() const;
|
|
|
| -#if defined(OS_POSIX) && !defined(OS_NACL)
|
| - // Returns a unique identifier for this shared memory segment. Inode numbers
|
| - // are technically only unique to a single filesystem. However, we always
|
| - // allocate shared memory backing files from the same directory, so will end
|
| - // up on the same filesystem.
|
| - SharedMemoryId id() const { return inode_; }
|
| -#endif
|
| -
|
| // Closes the open shared memory segment. The memory will remain mapped if
|
| // it was previously mapped.
|
| // It is safe to call Close repeatedly.
|
| @@ -289,7 +293,6 @@ class BASE_EXPORT SharedMemory {
|
| #elif defined(OS_POSIX)
|
| int mapped_file_;
|
| int readonly_mapped_file_;
|
| - ino_t inode_;
|
| #endif
|
| size_t mapped_size_;
|
| void* memory_;
|
|
|