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/bindings/lib/array_internal.h" | 5 #include "mojo/public/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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 ArrayDataTraits<bool>::BitRef& | 28 ArrayDataTraits<bool>::BitRef& |
29 ArrayDataTraits<bool>::BitRef::operator=(const BitRef& value) { | 29 ArrayDataTraits<bool>::BitRef::operator=(const BitRef& value) { |
30 return (*this) = static_cast<bool>(value); | 30 return (*this) = static_cast<bool>(value); |
31 } | 31 } |
32 | 32 |
33 ArrayDataTraits<bool>::BitRef::operator bool() const { | 33 ArrayDataTraits<bool>::BitRef::operator bool() const { |
34 return (*storage_ & mask_) != 0; | 34 return (*storage_ & mask_) != 0; |
35 } | 35 } |
36 | 36 |
| 37 // static |
| 38 void ArraySerializationHelper<Handle>::EncodePointersAndHandles( |
| 39 const ArrayHeader* header, |
| 40 ElementType* elements, |
| 41 std::vector<Handle>* handles) { |
| 42 for (uint32_t i = 0; i < header->num_elements; ++i) |
| 43 EncodeHandle(&elements[i], handles); |
| 44 } |
| 45 |
| 46 // static |
| 47 bool ArraySerializationHelper<Handle>::DecodePointersAndHandles( |
| 48 const ArrayHeader* header, |
| 49 ElementType* elements, |
| 50 Message* message) { |
| 51 for (uint32_t i = 0; i < header->num_elements; ++i) { |
| 52 if (!DecodeHandle(&elements[i], &message->handles)) |
| 53 return false; |
| 54 } |
| 55 return true; |
| 56 } |
| 57 |
37 } // namespace internal | 58 } // namespace internal |
38 } // namespace mojo | 59 } // namespace mojo |
OLD | NEW |