Index: ppapi/proxy/nacl_message_scanner.cc |
diff --git a/ppapi/proxy/nacl_message_scanner.cc b/ppapi/proxy/nacl_message_scanner.cc |
index 19edce26768e4ef656cec321ae7acdb3a71d1a6d..79e6fa7e170d83a7b4c9c77032ecd34e7b39ce46 100644 |
--- a/ppapi/proxy/nacl_message_scanner.cc |
+++ b/ppapi/proxy/nacl_message_scanner.cc |
@@ -59,9 +59,23 @@ void WriteHandle(int handle_index, |
base::Pickle* msg) { |
SerializedHandle::WriteHeader(handle.header(), msg); |
- if (handle.type() != SerializedHandle::INVALID) { |
+ if (handle.type() == SerializedHandle::SHARED_MEMORY) { |
// Now write the handle itself in POSIX style. |
- // See ParamTraits<FileDescriptor>::Read for where these values are read. |
+ // This serialization must be kept in sync with |
+ // ParamTraits<SharedMemoryHandle>::Write and |
+ // ParamTraits<UnguessableToken>::Write. |
+ if (handle.shmem().IsValid()) { |
+ msg->WriteBool(true); // valid == true |
+ msg->WriteInt(handle_index); |
+ msg->WriteUInt64(handle.shmem().GetGUID().GetHighForSerialization()); |
+ msg->WriteUInt64(handle.shmem().GetGUID().GetLowForSerialization()); |
+ } else { |
+ msg->WriteBool(false); // valid == false |
+ } |
+ } else if (handle.type() != SerializedHandle::INVALID) { |
+ // Now write the handle itself in POSIX style. |
+ // This serialization must be kept in sync with |
+ // ParamTraits<FileDescriptor>::Write. |
msg->WriteBool(true); // valid == true |
msg->WriteInt(handle_index); |
} |