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 #include "mojo/public/cpp/bindings/lib/array_internal.h" | 5 #include "mojo/public/cpp/bindings/lib/array_internal.h" |
6 | 6 |
7 namespace mojo { | 7 namespace mojo { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 ArrayDataTraits<bool>::BitRef::~BitRef() { | 10 ArrayDataTraits<bool>::BitRef::~BitRef() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 const ArrayHeader* header, | 66 const ArrayHeader* header, |
67 ElementType* elements, | 67 ElementType* elements, |
68 Message* message) { | 68 Message* message) { |
69 for (uint32_t i = 0; i < header->num_elements; ++i) { | 69 for (uint32_t i = 0; i < header->num_elements; ++i) { |
70 if (!DecodeHandle(&elements[i], message->mutable_handles())) | 70 if (!DecodeHandle(&elements[i], message->mutable_handles())) |
71 return false; | 71 return false; |
72 } | 72 } |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
| 76 // static |
| 77 bool ArraySerializationHelper<Handle, true>::ValidateElements( |
| 78 const ArrayHeader* header, |
| 79 const ElementType* elements, |
| 80 BoundsChecker* bounds_checker) { |
| 81 for (uint32_t i = 0; i < header->num_elements; ++i) { |
| 82 if (!bounds_checker->ClaimHandle(elements[i])) |
| 83 return false; |
| 84 } |
| 85 return true; |
| 86 } |
| 87 |
76 } // namespace internal | 88 } // namespace internal |
77 } // namespace mojo | 89 } // namespace mojo |
OLD | NEW |