| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "mojo/public/bindings/sample/generated/sample_service_serialization.h" | |
| 6 | |
| 7 namespace sample { | |
| 8 namespace internal { | |
| 9 | |
| 10 // static | |
| 11 Service_Frobinate_Params* Service_Frobinate_Params::New(mojo::Buffer* buf) { | |
| 12 return new (buf->Allocate(sizeof(Service_Frobinate_Params))) | |
| 13 Service_Frobinate_Params(); | |
| 14 } | |
| 15 | |
| 16 Service_Frobinate_Params::Service_Frobinate_Params() { | |
| 17 _header_.num_bytes = sizeof(*this); | |
| 18 _header_.num_fields = 3; | |
| 19 } | |
| 20 | |
| 21 } // namespace internal | |
| 22 } // namespace sample | |
| 23 | |
| 24 namespace mojo { | |
| 25 namespace internal { | |
| 26 | |
| 27 // static | |
| 28 void ObjectTraits<sample::internal::Service_Frobinate_Params>:: | |
| 29 EncodePointersAndHandles( | |
| 30 sample::internal::Service_Frobinate_Params* params, | |
| 31 std::vector<mojo::Handle>* handles) { | |
| 32 Encode(¶ms->foo_, handles); | |
| 33 EncodeHandle(¶ms->port_, handles); | |
| 34 } | |
| 35 | |
| 36 // static | |
| 37 bool ObjectTraits<sample::internal::Service_Frobinate_Params>:: | |
| 38 DecodePointersAndHandles( | |
| 39 sample::internal::Service_Frobinate_Params* params, | |
| 40 const mojo::Message& message) { | |
| 41 if (!Decode(¶ms->foo_, message)) | |
| 42 return false; | |
| 43 if (params->_header_.num_fields >= 3) { | |
| 44 if (!DecodeHandle(¶ms->port_, message.handles)) | |
| 45 return false; | |
| 46 } | |
| 47 | |
| 48 // TODO: validate | |
| 49 return true; | |
| 50 } | |
| 51 | |
| 52 } // namespace internal | |
| 53 } // namespace mojo | |
| OLD | NEW |