| 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/system/core.h" | 10 #include "mojo/public/cpp/system/core.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Note: This function doesn't validate the encoded pointer and handle values. | 64 // Note: This function doesn't validate the encoded pointer and handle values. |
| 65 template <typename T> | 65 template <typename T> |
| 66 inline void Decode(T* obj, std::vector<Handle>* handles) { | 66 inline void Decode(T* obj, std::vector<Handle>* handles) { |
| 67 DecodePointer(&obj->offset, &obj->ptr); | 67 DecodePointer(&obj->offset, &obj->ptr); |
| 68 if (obj->ptr) | 68 if (obj->ptr) |
| 69 obj->ptr->DecodePointersAndHandles(handles); | 69 obj->ptr->DecodePointersAndHandles(handles); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // If returns true, this function also claims the memory range of the size | 72 // If returns true, this function also claims the memory range of the size |
| 73 // specified in the struct header, starting from |data|. | 73 // specified in the struct header, starting from |data|. |
| 74 // Note: |min_num_bytes| must be no less than sizeof(StructHeader). |
| 74 bool ValidateStructHeader(const void* data, | 75 bool ValidateStructHeader(const void* data, |
| 75 uint32_t min_num_bytes, | 76 uint32_t min_num_bytes, |
| 76 uint32_t min_num_fields, | 77 uint32_t min_num_fields, |
| 77 BoundsChecker* bounds_checker); | 78 BoundsChecker* bounds_checker); |
| 78 | 79 |
| 79 } // namespace internal | 80 } // namespace internal |
| 80 } // namespace mojo | 81 } // namespace mojo |
| 81 | 82 |
| 82 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ | 83 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ |
| OLD | NEW |