| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/proxy/nacl_message_scanner.h" | 5 #include "ppapi/proxy/nacl_message_scanner.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Callback to receive the nested message in a resource message or reply. | 52 // Callback to receive the nested message in a resource message or reply. |
| 53 base::Callback<void(PP_Resource, const IPC::Message&, SerializedHandle*)> | 53 base::Callback<void(PP_Resource, const IPC::Message&, SerializedHandle*)> |
| 54 nested_msg_callback; | 54 nested_msg_callback; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 void WriteHandle(int handle_index, | 57 void WriteHandle(int handle_index, |
| 58 const SerializedHandle& handle, | 58 const SerializedHandle& handle, |
| 59 base::Pickle* msg) { | 59 base::Pickle* msg) { |
| 60 SerializedHandle::WriteHeader(handle.header(), msg); | 60 SerializedHandle::WriteHeader(handle.header(), msg); |
| 61 | 61 |
| 62 if (handle.type() != SerializedHandle::INVALID) { | 62 if (handle.type() == SerializedHandle::SHARED_MEMORY) { |
| 63 // Now write the handle itself in POSIX style. | 63 // Now write the handle itself in POSIX style. |
| 64 // See ParamTraits<FileDescriptor>::Read for where these values are read. | 64 // This serialization must be kept in sync with |
| 65 // ParamTraits<SharedMemoryHandle>::Write and |
| 66 // ParamTraits<UnguessableToken>::Write. |
| 67 msg->WriteBool(true); // valid == true |
| 68 msg->WriteInt(handle_index); |
| 69 msg->WriteUInt64(handle.shmem().GetGUID().GetHighForSerialization()); |
| 70 msg->WriteUInt64(handle.shmem().GetGUID().GetLowForSerialization()); |
| 71 } else if (handle.type() != SerializedHandle::INVALID) { |
| 72 // Now write the handle itself in POSIX style. |
| 73 // This serialization must be kept in sync with |
| 74 // ParamTraits<FileDescriptor>::Write. |
| 65 msg->WriteBool(true); // valid == true | 75 msg->WriteBool(true); // valid == true |
| 66 msg->WriteInt(handle_index); | 76 msg->WriteInt(handle_index); |
| 67 } | 77 } |
| 68 } | 78 } |
| 69 | 79 |
| 70 // Define overloads for each kind of message parameter that requires special | 80 // Define overloads for each kind of message parameter that requires special |
| 71 // handling. See ScanTuple for how these get used. | 81 // handling. See ScanTuple for how these get used. |
| 72 | 82 |
| 73 // Overload to match SerializedHandle. | 83 // Overload to match SerializedHandle. |
| 74 void ScanParam(const SerializedHandle& handle, ScanningResults* results) { | 84 void ScanParam(const SerializedHandle& handle, ScanningResults* results) { |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 fio_it->second->SetMaxWrittenOffset(offset_it->second); | 568 fio_it->second->SetMaxWrittenOffset(offset_it->second); |
| 559 } | 569 } |
| 560 } | 570 } |
| 561 break; | 571 break; |
| 562 } | 572 } |
| 563 } | 573 } |
| 564 } | 574 } |
| 565 | 575 |
| 566 } // namespace proxy | 576 } // namespace proxy |
| 567 } // namespace ppapi | 577 } // namespace ppapi |
| OLD | NEW |