Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: mojo/public/cpp/bindings/lib/native_struct.cc

Issue 2689513003: Add field-initializing constructors to generated mojo structs. (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/common/values.typemap ('k') | mojo/public/cpp/bindings/struct_ptr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « mojo/common/values.typemap ('k') | mojo/public/cpp/bindings/struct_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698