OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/resource_message_params.h" | 5 #include "ppapi/proxy/resource_message_params.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/proxy/ppapi_messages.h" | 9 #include "ppapi/proxy/ppapi_messages.h" |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 size_t index, | 84 size_t index, |
85 IPC::PlatformFileForTransit* handle) const { | 85 IPC::PlatformFileForTransit* handle) const { |
86 SerializedHandle serialized = TakeHandleOfTypeAtIndex( | 86 SerializedHandle serialized = TakeHandleOfTypeAtIndex( |
87 index, SerializedHandle::SOCKET); | 87 index, SerializedHandle::SOCKET); |
88 if (!serialized.is_socket()) | 88 if (!serialized.is_socket()) |
89 return false; | 89 return false; |
90 *handle = serialized.descriptor(); | 90 *handle = serialized.descriptor(); |
91 return true; | 91 return true; |
92 } | 92 } |
93 | 93 |
| 94 void ResourceMessageParams::TakeAllSharedMemoryHandles( |
| 95 std::vector<base::SharedMemoryHandle>* handles) const { |
| 96 for (size_t i = 0; i < handles_->data().size(); ++i) { |
| 97 base::SharedMemoryHandle handle; |
| 98 if (TakeSharedMemoryHandleAtIndex(i, &handle)) |
| 99 handles->push_back(handle); |
| 100 } |
| 101 } |
| 102 |
94 void ResourceMessageParams::AppendHandle(const SerializedHandle& handle) const { | 103 void ResourceMessageParams::AppendHandle(const SerializedHandle& handle) const { |
95 handles_->data().push_back(handle); | 104 handles_->data().push_back(handle); |
96 } | 105 } |
97 | 106 |
98 ResourceMessageCallParams::ResourceMessageCallParams() | 107 ResourceMessageCallParams::ResourceMessageCallParams() |
99 : ResourceMessageParams(), | 108 : ResourceMessageParams(), |
100 has_callback_(0) { | 109 has_callback_(0) { |
101 } | 110 } |
102 | 111 |
103 ResourceMessageCallParams::ResourceMessageCallParams(PP_Resource resource, | 112 ResourceMessageCallParams::ResourceMessageCallParams(PP_Resource resource, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 151 |
143 bool ResourceMessageReplyParams::Deserialize(const IPC::Message* msg, | 152 bool ResourceMessageReplyParams::Deserialize(const IPC::Message* msg, |
144 PickleIterator* iter) { | 153 PickleIterator* iter) { |
145 if (!ResourceMessageParams::Deserialize(msg, iter)) | 154 if (!ResourceMessageParams::Deserialize(msg, iter)) |
146 return false; | 155 return false; |
147 return IPC::ParamTraits<int32_t>::Read(msg, iter, &result_); | 156 return IPC::ParamTraits<int32_t>::Read(msg, iter, &result_); |
148 } | 157 } |
149 | 158 |
150 } // namespace proxy | 159 } // namespace proxy |
151 } // namespace ppapi | 160 } // namespace ppapi |
OLD | NEW |