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

Issue 1524703002: [mojo] Support native types with mojom wire format (Closed)

Created:
5 years ago by Ken Rockot(use gerrit already)
Modified:
4 years, 10 months ago
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, chromium-reviews, darin (slow to review), qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@bindings-5-pickles
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[mojo] Support native types with mojom wire format Add support for defining custom serialization routines to go between arbitrary C++ types and mojom struct types with no extra copying and no manual buffer management. Part of a series of changes to support custom mojom serialization: 1. https://codereview.chromium.org/1515423002 2. https://codereview.chromium.org/1517043004 3. https://codereview.chromium.org/1524693002 4. https://codereview.chromium.org/1520153002 5. https://codereview.chromium.org/1524613002 6. https://codereview.chromium.org/1526533002 7. This CL BUG=569669 TBR=yzshen@chromium.org Committed: https://crrev.com/770743799f563212a30682ec1a3d464cb7a89eae Cr-Commit-Position: refs/heads/master@{#365998}

Patch Set 1 #

Patch Set 2 : fix sizing, gyp #

Patch Set 3 : merge #

Patch Set 4 : merge #

Patch Set 5 : merge #

Patch Set 6 : merge #

Patch Set 7 : merge #

Patch Set 8 : no short circuit #

Patch Set 9 : make Reader cheaper #

Patch Set 10 : nicer traits #

Patch Set 11 : doc #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+546 lines, -5 lines) Patch
M mojo/public/cpp/bindings/BUILD.gn View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A mojo/public/cpp/bindings/struct_traits.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +35 lines, -0 lines 1 comment Download
M mojo/public/cpp/bindings/tests/BUILD.gn View 1 2 chunks +3 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/rect_blink.h View 1 2 3 4 5 6 7 8 9 1 chunk +85 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/rect_chromium.h View 1 2 3 4 5 6 7 8 9 1 chunk +87 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/struct_traits_unittest.cc View 1 2 3 4 5 6 1 chunk +185 lines, -0 lines 0 comments Download
M mojo/public/interfaces/bindings/tests/blink_test.typemap View 1 chunk +6 lines, -0 lines 0 comments Download
M mojo/public/interfaces/bindings/tests/chromium_test.typemap View 1 chunk +6 lines, -0 lines 0 comments Download
M mojo/public/interfaces/bindings/tests/test_native_types.mojom View 1 2 3 4 5 6 2 chunks +11 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl View 1 2 3 4 5 6 7 3 chunks +20 lines, -5 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl View 1 2 3 4 5 6 7 8 9 1 chunk +77 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl View 1 2 3 4 5 6 7 8 1 chunk +19 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/mojom_cpp_generator.py View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/mojo/mojo_edk_tests.gyp View 1 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (10 generated)
Ken Rockot(use gerrit already)
Here's a really basic starting point for serializing mojom-defined structs from native type traits. It ...
5 years ago (2015-12-16 01:39:24 UTC) #7
Ken Rockot(use gerrit already)
TBRing yzshen based on our offline discussion before he went OOO. This shouldn't have any ...
5 years ago (2015-12-18 02:50:14 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1524703002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1524703002/200001
5 years ago (2015-12-18 02:50:54 UTC) #11
commit-bot: I haz the power
Committed patchset #11 (id:200001)
5 years ago (2015-12-18 03:00:23 UTC) #12
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/770743799f563212a30682ec1a3d464cb7a89eae Cr-Commit-Position: refs/heads/master@{#365998}
5 years ago (2015-12-18 03:01:54 UTC) #14
Jeffrey Yasskin
Thanks! https://codereview.chromium.org/1524703002/diff/200001/mojo/public/cpp/bindings/struct_traits.h File mojo/public/cpp/bindings/struct_traits.h (right): https://codereview.chromium.org/1524703002/diff/200001/mojo/public/cpp/bindings/struct_traits.h#newcode25 mojo/public/cpp/bindings/struct_traits.h:25: // static bool Read(MojomType::Reader r, T* out); Could ...
4 years, 10 months ago (2016-01-28 18:01:40 UTC) #16
Ken Rockot(use gerrit already)
On 2016/01/28 at 18:01:40, jyasskin wrote: > Thanks! > > https://codereview.chromium.org/1524703002/diff/200001/mojo/public/cpp/bindings/struct_traits.h > File mojo/public/cpp/bindings/struct_traits.h (right): ...
4 years, 10 months ago (2016-01-28 20:35:26 UTC) #17
Ken Rockot(use gerrit already)
On 2016/01/28 at 20:35:26, Ken Rockot wrote: > On 2016/01/28 at 18:01:40, jyasskin wrote: > ...
4 years, 10 months ago (2016-01-28 20:37:10 UTC) #18
Ken Rockot(use gerrit already)
4 years, 10 months ago (2016-01-28 20:39:36 UTC) #19
Message was sent while issue was closed.
On 2016/01/28 at 20:37:10, Ken Rockot wrote:
> On 2016/01/28 at 20:35:26, Ken Rockot wrote:
> > On 2016/01/28 at 18:01:40, jyasskin wrote:
> > > Thanks!
> > > 
> > >
https://codereview.chromium.org/1524703002/diff/200001/mojo/public/cpp/bindin...
> > > File mojo/public/cpp/bindings/struct_traits.h (right):
> > > 
> > >
https://codereview.chromium.org/1524703002/diff/200001/mojo/public/cpp/bindin...
> > > mojo/public/cpp/bindings/struct_traits.h:25: //        static bool
Read(MojomType::Reader r, T* out);
> > > Could you document whether a 'true' or 'false' return is a failure?
> > > 
> > > Also, is there documentation for the API of the Reader type? (I haven't
looked yet, so sorry if it's obvious.)
> > > 
> > 
> > No, no documentation yet, and there should be :)
> > 
> > > And, what's a "serializable form"?
> > 
> > A "serializable form" is any type which is understood by the bindings layer
as the given field's mojom definition.
> 
> Err, that should read "understood by the bindings layer to be convertible to
the field's mojom-defined type"
> 
> > Currently since only POD and struct fields are supported, a serializable
form of a field of type T is a value
> > that is either of type T, implicitly convertible to T, or a type U for which
there exists a definition of
> > mojo::StructTraits<T, U>.

And one more addendum... in the near future there should be adapters so that
things like std::vector<T> can be
implicitly viewed as a mojo::Array<T> or mojo::Array<U> when
mojo::StructTraits<U, T> is defined; so a StructTraits
field accessor could return a const ref to a std::vector and the bindings layer
can copy data from it directly
into a message buffer.

Powered by Google App Engine
This is Rietveld 408576698