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

Unified Diff: ipc/mojo/ipc_channel_mojo.cc

Issue 883093003: IPC::Message Refactoring: Move POSIX specific bits to PlatformFileAttachment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: ipc/mojo/ipc_channel_mojo.cc
diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc
index 419d8d5bf9b57068b73467afe0f117117f0a6d0a..6c1dc8b6718035733ae7a12fccf89ce183ccff4e 100644
--- a/ipc/mojo/ipc_channel_mojo.cc
+++ b/ipc/mojo/ipc_channel_mojo.cc
@@ -16,6 +16,10 @@
#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h"
+#if defined(OS_POSIX) && !defined(OS_NACL)
+#include "ipc/ipc_platform_file_attachment.h"
+#endif
+
namespace IPC {
namespace {
@@ -352,8 +356,9 @@ MojoResult ChannelMojo::WriteToMessageAttachmentSet(
return unwrap_result;
}
- bool ok = message->attachment_set()->AddToOwn(
- base::ScopedFD(platform_handle.release().fd));
+ bool ok = message->attachment_set()->AddAttachment(
+ new internal::PlatformFileAttachment(
+ base::ScopedFD(platform_handle.release().fd)));
DCHECK(ok);
}
@@ -367,7 +372,7 @@ MojoResult ChannelMojo::ReadFromMessageAttachmentSet(
// We dup() the handles in IPC::Message to transmit.
// IPC::MessageAttachmentSet has intricate lifecycle semantics
// of FDs, so just to dup()-and-own them is the safest option.
- if (message->HasFileDescriptors()) {
+ if (message->HasAttachments()) {
MessageAttachmentSet* fdset = message->attachment_set();
std::vector<base::PlatformFile> fds_to_send(fdset->size());
fdset->PeekDescriptors(&fds_to_send[0]);

Powered by Google App Engine
This is Rietveld 408576698