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

Side by Side Diff: mojo/public/cpp/bindings/struct_traits.h

Issue 1524703002: [mojo] Support native types with mojom wire format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bindings-5-pickles
Patch Set: doc Created 5 years 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/public/cpp/bindings/BUILD.gn ('k') | mojo/public/cpp/bindings/tests/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
7
8 namespace mojo {
9
10 // This must be specialized for any type |T| to be serialized/deserialized as
11 // a mojom struct of type |MojomType|.
12 //
13 // Each specialization must implement a few things:
14 //
15 // 1. Static getters for each field in the Mojom type. These should be
16 // of the form:
17 //
18 // static <return type> <field name>(const T&)
19 //
20 // and should return a serializable form of the named field as extracted
21 // from the referenced |T| instance.
22 //
23 // 2. A static Read method to initialize a new |T| from a MojomType::Reader:
24 //
25 // static bool Read(MojomType::Reader r, T* out);
Jeffrey Yasskin 2016/01/28 18:01:40 Could you document whether a 'true' or 'false' ret
26 //
27 // The generated MojomType::Reader type provides a convenient, inexpensive
28 // view of a serialized struct's field data.
29 //
30 template <typename MojomType, typename T>
31 struct StructTraits;
32
33 } // namespace mojo
34
35 #endif // MOJO_PUBLIC_CPP_BINDINGS_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/BUILD.gn ('k') | mojo/public/cpp/bindings/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698