Index: base/memory/shared_memory_handle_posix.cc |
diff --git a/base/memory/shared_memory_handle_posix.cc b/base/memory/shared_memory_handle_posix.cc |
index 3e9a403b14c23f8700cbf4105632c661edd6c6dc..b97455962521fd42f561152c935483c91eef429c 100644 |
--- a/base/memory/shared_memory_handle_posix.cc |
+++ b/base/memory/shared_memory_handle_posix.cc |
@@ -8,24 +8,23 @@ |
#include "base/logging.h" |
#include "base/posix/eintr_wrapper.h" |
+#include "base/unguessable_token.h" |
namespace base { |
SharedMemoryHandle::SharedMemoryHandle() = default; |
-SharedMemoryHandle::SharedMemoryHandle(const SharedMemoryHandle& handle) = |
- default; |
-SharedMemoryHandle& SharedMemoryHandle::operator=( |
- const SharedMemoryHandle& handle) = default; |
SharedMemoryHandle::SharedMemoryHandle( |
- const base::FileDescriptor& file_descriptor) |
- : file_descriptor_(file_descriptor) {} |
+ const base::FileDescriptor& file_descriptor, |
+ const base::UnguessableToken& guid) |
+ : file_descriptor_(file_descriptor), guid_(guid) {} |
// static |
SharedMemoryHandle SharedMemoryHandle::ImportHandle(int fd) { |
SharedMemoryHandle handle; |
handle.file_descriptor_.fd = fd; |
handle.file_descriptor_.auto_close = false; |
+ handle.guid_ = UnguessableToken::Create(); |
return handle; |
} |
@@ -59,7 +58,7 @@ SharedMemoryHandle SharedMemoryHandle::Duplicate() const { |
int duped_handle = HANDLE_EINTR(dup(file_descriptor_.fd)); |
if (duped_handle < 0) |
return SharedMemoryHandle(); |
- return SharedMemoryHandle(FileDescriptor(duped_handle, true)); |
+ return SharedMemoryHandle(FileDescriptor(duped_handle, true), GetGUID()); |
} |
void SharedMemoryHandle::SetOwnershipPassesToIPC(bool ownership_passes) { |