| 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_ARRAY_INTERNAL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 class Array_Data { | 256 class Array_Data { |
| 257 public: | 257 public: |
| 258 using Traits = ArrayDataTraits<T>; | 258 using Traits = ArrayDataTraits<T>; |
| 259 using StorageType = typename Traits::StorageType; | 259 using StorageType = typename Traits::StorageType; |
| 260 using Ref = typename Traits::Ref; | 260 using Ref = typename Traits::Ref; |
| 261 using ConstRef = typename Traits::ConstRef; | 261 using ConstRef = typename Traits::ConstRef; |
| 262 using Helper = ArraySerializationHelper< | 262 using Helper = ArraySerializationHelper< |
| 263 T, | 263 T, |
| 264 IsUnionDataType<T>::value, | 264 IsUnionDataType<T>::value, |
| 265 std::is_same<T, AssociatedInterface_Data>::value || | 265 std::is_same<T, AssociatedInterface_Data>::value || |
| 266 std::is_same<T, AssociatedInterfaceRequest_Data>::value || | 266 std::is_same<T, AssociatedEndpointHandle_Data>::value || |
| 267 std::is_same<T, Interface_Data>::value || | 267 std::is_same<T, Interface_Data>::value || |
| 268 std::is_same<T, Handle_Data>::value>; | 268 std::is_same<T, Handle_Data>::value>; |
| 269 using Element = T; | 269 using Element = T; |
| 270 | 270 |
| 271 // Returns null if |num_elements| or the corresponding storage size cannot be | 271 // Returns null if |num_elements| or the corresponding storage size cannot be |
| 272 // stored in uint32_t. | 272 // stored in uint32_t. |
| 273 static Array_Data<T>* New(size_t num_elements, Buffer* buf) { | 273 static Array_Data<T>* New(size_t num_elements, Buffer* buf) { |
| 274 if (num_elements > Traits::kMaxNumElements) | 274 if (num_elements > Traits::kMaxNumElements) |
| 275 return nullptr; | 275 return nullptr; |
| 276 | 276 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 }; | 359 }; |
| 360 static_assert(sizeof(Array_Data<char>) == 8, "Bad sizeof(Array_Data)"); | 360 static_assert(sizeof(Array_Data<char>) == 8, "Bad sizeof(Array_Data)"); |
| 361 | 361 |
| 362 // UTF-8 encoded | 362 // UTF-8 encoded |
| 363 using String_Data = Array_Data<char>; | 363 using String_Data = Array_Data<char>; |
| 364 | 364 |
| 365 } // namespace internal | 365 } // namespace internal |
| 366 } // namespace mojo | 366 } // namespace mojo |
| 367 | 367 |
| 368 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_ | 368 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_INTERNAL_H_ |
| OLD | NEW |