| 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 DecodePointer(&obj->offset, &obj->ptr); | 62 DecodePointer(&obj->offset, &obj->ptr); |
| 63 if (obj->ptr) | 63 if (obj->ptr) |
| 64 obj->ptr->DecodePointers(); | 64 obj->ptr->DecodePointers(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 template <typename T> | 67 template <typename T> |
| 68 inline void AssociatedInterfacePtrInfoToData( | 68 inline void AssociatedInterfacePtrInfoToData( |
| 69 AssociatedInterfacePtrInfo<T> input, | 69 AssociatedInterfacePtrInfo<T> input, |
| 70 AssociatedInterface_Data* output) { | 70 AssociatedInterface_Data* output) { |
| 71 output->version = input.version(); | 71 output->version = input.version(); |
| 72 output->interface_id = | 72 output->interface_id = input.PassHandle().release(); |
| 73 AssociatedInterfacePtrInfoHelper::PassHandle(&input).release(); | |
| 74 } | 73 } |
| 75 | 74 |
| 76 template <typename T> | 75 template <typename T> |
| 77 inline void AssociatedInterfaceDataToPtrInfo( | 76 inline void AssociatedInterfaceDataToPtrInfo( |
| 78 AssociatedInterface_Data* input, | 77 AssociatedInterface_Data* input, |
| 79 AssociatedInterfacePtrInfo<T>* output, | 78 AssociatedInterfacePtrInfo<T>* output, |
| 80 MultiplexRouter* router) { | 79 MultiplexRouter* router) { |
| 81 AssociatedInterfacePtrInfoHelper::SetHandle( | 80 output->set_handle( |
| 82 output, | |
| 83 router->CreateLocalEndpointHandle(FetchAndReset(&input->interface_id))); | 81 router->CreateLocalEndpointHandle(FetchAndReset(&input->interface_id))); |
| 84 output->set_version(input->version); | 82 output->set_version(input->version); |
| 85 } | 83 } |
| 86 | 84 |
| 87 template <typename T> | 85 template <typename T> |
| 88 inline void InterfacePointerToData(InterfacePtr<T> input, | 86 inline void InterfacePointerToData(InterfacePtr<T> input, |
| 89 Interface_Data* output, | 87 Interface_Data* output, |
| 90 SerializationContext* context) { | 88 SerializationContext* context) { |
| 91 InterfacePtrInfo<T> info = input.PassInterface(); | 89 InterfacePtrInfo<T> info = input.PassInterface(); |
| 92 output->handle = context->handles.AddHandle(info.PassHandle().release()); | 90 output->handle = context->handles.AddHandle(info.PassHandle().release()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 ReturnType CallWithContext(ReturnType (*f)(ParamType), | 224 ReturnType CallWithContext(ReturnType (*f)(ParamType), |
| 227 MaybeConstUserType& input, | 225 MaybeConstUserType& input, |
| 228 void* context) { | 226 void* context) { |
| 229 return f(input); | 227 return f(input); |
| 230 } | 228 } |
| 231 | 229 |
| 232 } // namespace internal | 230 } // namespace internal |
| 233 } // namespace mojo | 231 } // namespace mojo |
| 234 | 232 |
| 235 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ | 233 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ |
| OLD | NEW |