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_BINDINGS_SERIALIZATION_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 template <typename T> | 72 template <typename T> |
73 inline void Decode(T* obj, std::vector<Handle>* handles) { | 73 inline void Decode(T* obj, std::vector<Handle>* handles) { |
74 DecodePointer(&obj->offset, &obj->ptr); | 74 DecodePointer(&obj->offset, &obj->ptr); |
75 if (obj->ptr) | 75 if (obj->ptr) |
76 obj->ptr->DecodePointersAndHandles(handles); | 76 obj->ptr->DecodePointersAndHandles(handles); |
77 } | 77 } |
78 | 78 |
79 template <typename T> | 79 template <typename T> |
80 inline void InterfacePointerToData(InterfacePtr<T> input, | 80 inline void InterfacePointerToData(InterfacePtr<T> input, |
81 Interface_Data* output) { | 81 Interface_Data* output) { |
82 InterfaceHandle<T> info = input.PassInterface(); | 82 InterfaceHandle<T> info = input.PassInterfaceHandle(); |
83 output->handle = info.PassHandle().release(); | 83 output->handle = info.PassHandle().release(); |
84 output->version = info.version(); | 84 output->version = info.version(); |
85 } | 85 } |
86 | 86 |
87 template <typename T> | 87 template <typename T> |
88 inline void InterfaceDataToPointer(Interface_Data* input, | 88 inline void InterfaceDataToPointer(Interface_Data* input, |
89 InterfacePtr<T>* output) { | 89 InterfacePtr<T>* output) { |
90 output->Bind(InterfaceHandle<T>( | 90 output->Bind(InterfaceHandle<T>( |
91 MakeScopedHandle(FetchAndReset(&input->handle)), input->version)); | 91 MakeScopedHandle(FetchAndReset(&input->handle)), input->version)); |
92 } | 92 } |
93 | 93 |
94 } // namespace internal | 94 } // namespace internal |
95 } // namespace mojo | 95 } // namespace mojo |
96 | 96 |
97 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ | 97 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ |
OLD | NEW |