OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ARRAY_TRAITS_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ |
7 | 7 |
8 namespace mojo { | 8 namespace mojo { |
9 | 9 |
10 // This must be specialized for any type |T| to be serialized/deserialized as | 10 // This must be specialized for any type |T| to be serialized/deserialized as |
(...skipping 14 matching lines...) Expand all Loading... |
25 // static size_t GetSize(const CustomArray<T>& input); | 25 // static size_t GetSize(const CustomArray<T>& input); |
26 // | 26 // |
27 // // These two methods are optional. They are used to access the | 27 // // These two methods are optional. They are used to access the |
28 // // underlying storage of the array to speed up copy of POD types. | 28 // // underlying storage of the array to speed up copy of POD types. |
29 // static T* GetData(CustomArray<T>& input); | 29 // static T* GetData(CustomArray<T>& input); |
30 // static const T* GetData(const CustomArray<T>& input); | 30 // static const T* GetData(const CustomArray<T>& input); |
31 // | 31 // |
32 // static T& GetAt(CustomArray<T>& input, size_t index); | 32 // static T& GetAt(CustomArray<T>& input, size_t index); |
33 // static const T& GetAt(const CustomArray<T>& input, size_t index); | 33 // static const T& GetAt(const CustomArray<T>& input, size_t index); |
34 // | 34 // |
35 // static void Resize(CustomArray<T>& input, size_t size); | 35 // Returning false results in deserialization failure and causes the message |
| 36 // pipe receiving it to be disconnected. |
| 37 // static bool Resize(CustomArray<T>& input, size_t size); |
36 // }; | 38 // }; |
37 // | 39 // |
38 template <typename T> | 40 template <typename T> |
39 struct ArrayTraits; | 41 struct ArrayTraits; |
40 | 42 |
41 } // namespace mojo | 43 } // namespace mojo |
42 | 44 |
43 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ | 45 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_ |
OLD | NEW |