| 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 return NativeStructPtr(base::in_place); |
| 14 internal::StructHelper<NativeStruct>::Initialize(&rv); | |
| 15 return rv; | |
| 16 } | 14 } |
| 17 | 15 |
| 18 NativeStruct::NativeStruct() {} | 16 NativeStruct::NativeStruct() {} |
| 19 | 17 |
| 20 NativeStruct::~NativeStruct() {} | 18 NativeStruct::~NativeStruct() {} |
| 21 | 19 |
| 22 NativeStructPtr NativeStruct::Clone() const { | 20 NativeStructPtr NativeStruct::Clone() const { |
| 23 NativeStructPtr rv(New()); | 21 NativeStructPtr rv(New()); |
| 24 rv->data = data; | 22 rv->data = data; |
| 25 return rv; | 23 return rv; |
| 26 } | 24 } |
| 27 | 25 |
| 28 bool NativeStruct::Equals(const NativeStruct& other) const { | 26 bool NativeStruct::Equals(const NativeStruct& other) const { |
| 29 return data == other.data; | 27 return data == other.data; |
| 30 } | 28 } |
| 31 | 29 |
| 32 size_t NativeStruct::Hash(size_t seed) const { | 30 size_t NativeStruct::Hash(size_t seed) const { |
| 33 return internal::Hash(seed, data); | 31 return internal::Hash(seed, data); |
| 34 } | 32 } |
| 35 | 33 |
| 36 } // namespace mojo | 34 } // namespace mojo |
| OLD | NEW |