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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const ArrayHeader* header, | 48 const ArrayHeader* header, |
49 ElementType* elements, | 49 ElementType* elements, |
50 Message* message) { | 50 Message* message) { |
51 for (uint32_t i = 0; i < header->num_elements; ++i) { | 51 for (uint32_t i = 0; i < header->num_elements; ++i) { |
52 if (!DecodeHandle(&elements[i], message->mutable_handles())) | 52 if (!DecodeHandle(&elements[i], message->mutable_handles())) |
53 return false; | 53 return false; |
54 } | 54 } |
55 return true; | 55 return true; |
56 } | 56 } |
57 | 57 |
| 58 // static |
| 59 bool ArraySerializationHelper<Handle, true>::ValidateElements( |
| 60 const ArrayHeader* header, |
| 61 const ElementType* elements, |
| 62 BoundsChecker* bounds_checker) { |
| 63 for (uint32_t i = 0; i < header->num_elements; ++i) { |
| 64 if (!bounds_checker->ClaimHandle(elements[i])) |
| 65 return false; |
| 66 } |
| 67 return true; |
| 68 } |
| 69 |
58 } // namespace internal | 70 } // namespace internal |
59 } // namespace mojo | 71 } // namespace mojo |
OLD | NEW |