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

Unified Diff: ipc/mojo/ipc_channel_mojo.cc

Issue 2047953002: Explicitly serialise platform file attachments instead of doing them implicitly as a mojo handle at… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/mojo/ipc.mojom ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo.cc
diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc
index db089d6cb6191e11fdcfb5117b36f893f4f965d7..6571103db020be1c8bd00bf1159a853515ebc931 100644
--- a/ipc/mojo/ipc_channel_mojo.cc
+++ b/ipc/mojo/ipc_channel_mojo.cc
@@ -115,7 +115,7 @@ MojoResult WrapAttachmentImpl(MessageAttachment* attachment,
return WrapPlatformHandle(mojo::edk::ScopedPlatformHandle(
mojo::edk::PlatformHandle(file.release())),
- mojom::SerializedHandle::Type::MOJO_HANDLE,
+ mojom::SerializedHandle::Type::PLATFORM_FILE,
serialized);
}
#endif
@@ -175,6 +175,14 @@ MojoResult UnwrapAttachment(mojom::SerializedHandlePtr handle,
handle->the_handle.release().value(), &platform_handle);
if (unwrap_result != MOJO_RESULT_OK)
return unwrap_result;
+#if defined(OS_POSIX)
+ if (handle->type == mojom::SerializedHandle::Type::PLATFORM_FILE &&
+ platform_handle.get().type == mojo::edk::PlatformHandle::Type::POSIX) {
+ *attachment = new internal::PlatformFileAttachment(
+ platform_handle.release().handle);
+ return MOJO_RESULT_OK;
+ }
+#endif // defined(OS_POSIX)
#if defined(OS_MACOSX)
if (handle->type == mojom::SerializedHandle::Type::MACH_PORT &&
platform_handle.get().type == mojo::edk::PlatformHandle::Type::MACH) {
« no previous file with comments | « ipc/mojo/ipc.mojom ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698