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

Unified Diff: ipc/ipc_message_utils.cc

Issue 2047233002: Support using a Mojo message pipe in a ChannelHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-handle-attachemnt-public-api
Patch Set: comment 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
Index: ipc/ipc_message_utils.cc
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index 302778e495eccab005e2ec54e2c5a258b25f1f17..755db1b80934d190c0b163afa14b7304413d1cb7 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -18,6 +18,7 @@
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_attachment.h"
#include "ipc/ipc_message_attachment_set.h"
+#include "ipc/ipc_mojo_param_traits.h"
#if defined(OS_POSIX)
#include "ipc/ipc_platform_file_attachment_posix.h"
@@ -638,7 +639,8 @@ void ParamTraits<base::DictionaryValue>::Log(const param_type& p,
void ParamTraits<base::FileDescriptor>::GetSize(base::PickleSizer* sizer,
const param_type& p) {
GetParamSize(sizer, p.fd >= 0);
- sizer->AddAttachment();
+ if (p.fd >= 0)
+ sizer->AddAttachment();
}
void ParamTraits<base::FileDescriptor>::Write(base::Pickle* m,
@@ -1002,6 +1004,7 @@ void ParamTraits<IPC::ChannelHandle>::GetSize(base::PickleSizer* sizer,
#if defined(OS_POSIX)
GetParamSize(sizer, p.socket);
#endif
+ GetParamSize(sizer, p.mojo_handle);
}
void ParamTraits<IPC::ChannelHandle>::Write(base::Pickle* m,
@@ -1014,6 +1017,7 @@ void ParamTraits<IPC::ChannelHandle>::Write(base::Pickle* m,
#if defined(OS_POSIX)
WriteParam(m, p.socket);
#endif
+ WriteParam(m, p.mojo_handle);
}
bool ParamTraits<IPC::ChannelHandle>::Read(const base::Pickle* m,
@@ -1023,7 +1027,7 @@ bool ParamTraits<IPC::ChannelHandle>::Read(const base::Pickle* m,
#if defined(OS_POSIX)
&& ReadParam(m, iter, &r->socket)
#endif
- ;
+ && ReadParam(m, iter, &r->mojo_handle);
}
void ParamTraits<IPC::ChannelHandle>::Log(const param_type& p,
@@ -1033,6 +1037,8 @@ void ParamTraits<IPC::ChannelHandle>::Log(const param_type& p,
l->append(", ");
ParamTraits<base::FileDescriptor>::Log(p.socket, l);
#endif
+ l->append(", ");
+ ParamTraits<mojo::MessagePipeHandle>::Log(p.mojo_handle, l);
dcheng 2016/06/27 01:55:32 Can this just be LogParam?
Anand Mistry (off Chromium) 2016/06/27 02:40:43 Done.
l->append(")");
}

Powered by Google App Engine
This is Rietveld 408576698