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

Unified Diff: mojo/edk/embedder/platform_shared_buffer.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 | « ipc/ipc_message_utils.cc ('k') | mojo/edk/system/platform_wrapper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/embedder/platform_shared_buffer.cc
diff --git a/mojo/edk/embedder/platform_shared_buffer.cc b/mojo/edk/embedder/platform_shared_buffer.cc
index 6e11f05b33f9cacca8aa1bfeee3d10a15bd82a9f..7548b4d9beffe26a43e905440382a908edc17a94 100644
--- a/mojo/edk/embedder/platform_shared_buffer.cc
+++ b/mojo/edk/embedder/platform_shared_buffer.cc
@@ -233,14 +233,16 @@ bool PlatformSharedBuffer::InitFromPlatformHandle(
ScopedPlatformHandle platform_handle) {
DCHECK(!shared_memory_);
+ // TODO(rockot): Pass GUIDs through Mojo. https://crbug.com/713763.
+ base::UnguessableToken guid = base::UnguessableToken::Create();
#if defined(OS_WIN)
- base::SharedMemoryHandle handle(platform_handle.release().handle);
+ base::SharedMemoryHandle handle(platform_handle.release().handle, guid);
#elif defined(OS_MACOSX) && !defined(OS_IOS)
- base::SharedMemoryHandle handle;
- handle = base::SharedMemoryHandle(platform_handle.release().port, num_bytes_);
+ base::SharedMemoryHandle handle = base::SharedMemoryHandle(
+ platform_handle.release().port, num_bytes_, guid);
#else
base::SharedMemoryHandle handle(
- base::FileDescriptor(platform_handle.release().handle, false));
+ base::FileDescriptor(platform_handle.release().handle, false), guid);
#endif
shared_memory_.reset(new base::SharedMemory(handle, read_only_));
@@ -255,14 +257,16 @@ bool PlatformSharedBuffer::InitFromPlatformHandlePair(
return false;
#else // defined(OS_MACOSX)
+ // TODO(rockot): Pass GUIDs through Mojo. https://crbug.com/713763.
+ base::UnguessableToken guid = base::UnguessableToken::Create();
#if defined(OS_WIN)
- base::SharedMemoryHandle handle(rw_platform_handle.release().handle);
- base::SharedMemoryHandle ro_handle(ro_platform_handle.release().handle);
+ base::SharedMemoryHandle handle(rw_platform_handle.release().handle, guid);
+ base::SharedMemoryHandle ro_handle(ro_platform_handle.release().handle, guid);
#else // defined(OS_WIN)
base::SharedMemoryHandle handle(
- base::FileDescriptor(rw_platform_handle.release().handle, false));
+ base::FileDescriptor(rw_platform_handle.release().handle, false), guid);
base::SharedMemoryHandle ro_handle(
- base::FileDescriptor(ro_platform_handle.release().handle, false));
+ base::FileDescriptor(ro_platform_handle.release().handle, false), guid);
#endif // defined(OS_WIN)
DCHECK(!shared_memory_);
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | mojo/edk/system/platform_wrapper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698