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

Unified Diff: base/memory/shared_memory_handle_posix.cc

Issue 2859843002: Add a GUID to base::SharedMemoryHandle. (Closed)
Patch Set: fix guid on android. Created 3 years, 7 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/memory/shared_memory_handle_mac.cc ('k') | base/memory/shared_memory_handle_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « base/memory/shared_memory_handle_mac.cc ('k') | base/memory/shared_memory_handle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698