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/ppapi_param_traits.h" | 5 #include "ppapi/proxy/ppapi_param_traits.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 // static | 229 // static |
230 void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m, | 230 void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m, |
231 const param_type& p) { | 231 const param_type& p) { |
232 ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m); | 232 ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m); |
233 switch (p.type()) { | 233 switch (p.type()) { |
234 case ppapi::proxy::SerializedHandle::SHARED_MEMORY: | 234 case ppapi::proxy::SerializedHandle::SHARED_MEMORY: |
235 ParamTraits<base::SharedMemoryHandle>::Write(m, p.shmem()); | 235 ParamTraits<base::SharedMemoryHandle>::Write(m, p.shmem()); |
236 break; | 236 break; |
237 case ppapi::proxy::SerializedHandle::SOCKET: | 237 case ppapi::proxy::SerializedHandle::SOCKET: |
238 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: | |
239 case ppapi::proxy::SerializedHandle::FILE: | 238 case ppapi::proxy::SerializedHandle::FILE: |
240 ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor()); | 239 ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor()); |
241 break; | 240 break; |
242 case ppapi::proxy::SerializedHandle::INVALID: | 241 case ppapi::proxy::SerializedHandle::INVALID: |
243 break; | 242 break; |
244 // No default so the compiler will warn on new types. | 243 // No default so the compiler will warn on new types. |
245 } | 244 } |
246 } | 245 } |
247 | 246 |
248 // static | 247 // static |
(...skipping 13 matching lines...) Expand all Loading... |
262 break; | 261 break; |
263 } | 262 } |
264 case ppapi::proxy::SerializedHandle::SOCKET: { | 263 case ppapi::proxy::SerializedHandle::SOCKET: { |
265 IPC::PlatformFileForTransit socket; | 264 IPC::PlatformFileForTransit socket; |
266 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &socket)) { | 265 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &socket)) { |
267 r->set_socket(socket); | 266 r->set_socket(socket); |
268 return true; | 267 return true; |
269 } | 268 } |
270 break; | 269 break; |
271 } | 270 } |
272 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: { | |
273 IPC::PlatformFileForTransit desc; | |
274 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) { | |
275 r->set_channel_handle(desc); | |
276 return true; | |
277 } | |
278 break; | |
279 } | |
280 case ppapi::proxy::SerializedHandle::FILE: { | 271 case ppapi::proxy::SerializedHandle::FILE: { |
281 IPC::PlatformFileForTransit desc; | 272 IPC::PlatformFileForTransit desc; |
282 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) { | 273 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) { |
283 r->set_file_handle(desc, header.open_flags, header.file_io); | 274 r->set_file_handle(desc, header.open_flags, header.file_io); |
284 return true; | 275 return true; |
285 } | 276 } |
286 break; | 277 break; |
287 } | 278 } |
288 case ppapi::proxy::SerializedHandle::INVALID: | 279 case ppapi::proxy::SerializedHandle::INVALID: |
289 return true; | 280 return true; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 } | 627 } |
637 return false; | 628 return false; |
638 } | 629 } |
639 | 630 |
640 // static | 631 // static |
641 void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, | 632 void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, |
642 std::string* l) { | 633 std::string* l) { |
643 } | 634 } |
644 | 635 |
645 } // namespace IPC | 636 } // namespace IPC |
OLD | NEW |