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 #include "mojo/public/cpp/bindings/native_struct.h" | 5 #include "mojo/public/cpp/bindings/native_struct.h" |
6 | 6 |
| 7 #include "mojo/public/cpp/bindings/lib/hash_util.h" |
| 8 |
7 namespace mojo { | 9 namespace mojo { |
8 | 10 |
9 // static | 11 // static |
10 NativeStructPtr NativeStruct::New() { | 12 NativeStructPtr NativeStruct::New() { |
11 NativeStructPtr rv; | 13 NativeStructPtr rv; |
12 internal::StructHelper<NativeStruct>::Initialize(&rv); | 14 internal::StructHelper<NativeStruct>::Initialize(&rv); |
13 return rv; | 15 return rv; |
14 } | 16 } |
15 | 17 |
16 NativeStruct::NativeStruct() : data(nullptr) {} | 18 NativeStruct::NativeStruct() : data(nullptr) {} |
17 | 19 |
18 NativeStruct::~NativeStruct() {} | 20 NativeStruct::~NativeStruct() {} |
19 | 21 |
20 NativeStructPtr NativeStruct::Clone() const { | 22 NativeStructPtr NativeStruct::Clone() const { |
21 NativeStructPtr rv(New()); | 23 NativeStructPtr rv(New()); |
22 rv->data = data.Clone(); | 24 rv->data = data.Clone(); |
23 return rv; | 25 return rv; |
24 } | 26 } |
25 | 27 |
26 bool NativeStruct::Equals(const NativeStruct& other) const { | 28 bool NativeStruct::Equals(const NativeStruct& other) const { |
27 return data.Equals(other.data); | 29 return data.Equals(other.data); |
28 } | 30 } |
29 | 31 |
| 32 size_t NativeStruct::Hash(size_t seed) const { |
| 33 return internal::Hash(seed, data); |
| 34 } |
| 35 |
30 } // namespace mojo | 36 } // namespace mojo |
OLD | NEW |