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 bool ResourceMessageParams::TakeFileHandleAtIndex( | |
95 size_t index, | |
96 IPC::PlatformFileForTransit* handle) const { | |
97 SerializedHandle serialized = TakeHandleOfTypeAtIndex( | |
98 index, SerializedHandle::FILE); | |
99 if (!serialized.is_file()) | |
100 return false; | |
101 *handle = serialized.descriptor(); | |
102 return true; | |
103 } | |
104 | |
105 void ResourceMessageParams::TakeAllSharedMemoryHandles( | 94 void ResourceMessageParams::TakeAllSharedMemoryHandles( |
106 std::vector<base::SharedMemoryHandle>* handles) const { | 95 std::vector<base::SharedMemoryHandle>* handles) const { |
107 for (size_t i = 0; i < handles_->data().size(); ++i) { | 96 for (size_t i = 0; i < handles_->data().size(); ++i) { |
108 base::SharedMemoryHandle handle; | 97 base::SharedMemoryHandle handle; |
109 if (TakeSharedMemoryHandleAtIndex(i, &handle)) | 98 if (TakeSharedMemoryHandleAtIndex(i, &handle)) |
110 handles->push_back(handle); | 99 handles->push_back(handle); |
111 } | 100 } |
112 } | 101 } |
113 | 102 |
114 void ResourceMessageParams::AppendHandle(const SerializedHandle& handle) const { | 103 void ResourceMessageParams::AppendHandle(const SerializedHandle& handle) const { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 151 |
163 bool ResourceMessageReplyParams::Deserialize(const IPC::Message* msg, | 152 bool ResourceMessageReplyParams::Deserialize(const IPC::Message* msg, |
164 PickleIterator* iter) { | 153 PickleIterator* iter) { |
165 if (!ResourceMessageParams::Deserialize(msg, iter)) | 154 if (!ResourceMessageParams::Deserialize(msg, iter)) |
166 return false; | 155 return false; |
167 return IPC::ParamTraits<int32_t>::Read(msg, iter, &result_); | 156 return IPC::ParamTraits<int32_t>::Read(msg, iter, &result_); |
168 } | 157 } |
169 | 158 |
170 } // namespace proxy | 159 } // namespace proxy |
171 } // namespace ppapi | 160 } // namespace ppapi |
OLD | NEW |