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