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

Issue 1966933002: Mojo C++ bindings: switch the existing usage of StructTraits to use the new data view interface. (Closed)

Created:
4 years, 7 months ago by yzshen1
Modified:
4 years, 7 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@26_reader
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mojo C++ bindings: switch the existing usage of StructTraits to use the new data view interface. BUG=577686 Committed: https://crrev.com/2017646cf12650e54c22fab5195dfb225617a009 Cr-Commit-Position: refs/heads/master@{#393448}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 2

Patch Set 4 : #

Patch Set 5 : typeid() is not allowed :/ #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+122 lines, -236 lines) Patch
M mojo/public/cpp/bindings/lib/array_serialization.h View 1 2 3 1 chunk +3 lines, -4 lines 0 comments Download
M mojo/public/cpp/bindings/lib/array_traits_standard.h View 1 2 3 2 chunks +1 line, -2 lines 0 comments Download
M mojo/public/cpp/bindings/lib/array_traits_wtf.h View 1 2 3 2 chunks +1 line, -2 lines 0 comments Download
M mojo/public/cpp/bindings/lib/serialization_util.h View 1 2 3 4 2 chunks +31 lines, -14 lines 0 comments Download
M mojo/public/cpp/bindings/lib/string_serialization.h View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/string_traits_wtf.cc View 1 2 3 2 chunks +11 lines, -7 lines 0 comments Download
M mojo/public/cpp/bindings/string_traits.h View 1 2 3 1 chunk +5 lines, -13 lines 0 comments Download
M mojo/public/cpp/bindings/string_traits_standard.h View 1 2 3 1 chunk +3 lines, -6 lines 0 comments Download
M mojo/public/cpp/bindings/string_traits_string_piece.h View 1 2 3 2 chunks +14 lines, -10 lines 3 comments Download
M mojo/public/cpp/bindings/string_traits_wtf.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/rect_blink_traits.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/cpp/bindings/tests/rect_chromium_traits.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h View 1 1 chunk +2 lines, -5 lines 0 comments Download
M mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc View 1 2 3 1 chunk +9 lines, -7 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl View 1 1 chunk +0 lines, -1 line 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl View 1 2 3 1 chunk +0 lines, -6 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl View 1 2 3 9 chunks +3 lines, -14 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl View 1 2 3 1 chunk +0 lines, -2 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl View 1 2 3 3 chunks +7 lines, -29 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl View 1 2 3 1 chunk +5 lines, -10 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl View 2 chunks +0 lines, -47 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl View 1 chunk +0 lines, -42 lines 0 comments Download
M url/mojo/origin_struct_traits.h View 1 2 3 1 chunk +12 lines, -5 lines 0 comments Download
M url/mojo/url_gurl_struct_traits.h View 1 2 3 1 chunk +10 lines, -8 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 32 (5 generated)
yzshen1
Hi, Ken and John. Would you please take a look? Thanks! One thing that I ...
4 years, 7 months ago (2016-05-10 23:27:15 UTC) #2
Ken Rockot(use gerrit already)
On 2016/05/10 at 23:27:15, yzshen wrote: > Hi, Ken and John. > > Would you ...
4 years, 7 months ago (2016-05-11 15:25:07 UTC) #3
yzshen1
On 2016/05/11 15:25:07, Ken Rockot wrote: > On 2016/05/10 at 23:27:15, yzshen wrote: > > ...
4 years, 7 months ago (2016-05-11 15:57:21 UTC) #4
Ken Rockot(use gerrit already)
On 2016/05/11 at 15:57:21, yzshen wrote: > On 2016/05/11 15:25:07, Ken Rockot wrote: > > ...
4 years, 7 months ago (2016-05-11 16:13:16 UTC) #5
yzshen1
+Daniel for struct traits security review. This CL change StructTraits::Read() to use a new type ...
4 years, 7 months ago (2016-05-11 17:33:38 UTC) #7
dcheng
https://codereview.chromium.org/1966933002/diff/40001/url/mojo/origin_struct_traits.h File url/mojo/origin_struct_traits.h (right): https://codereview.chromium.org/1966933002/diff/40001/url/mojo/origin_struct_traits.h#newcode29 url/mojo/origin_struct_traits.h:29: if (data.is_null()) { Why/when would data be null? Why ...
4 years, 7 months ago (2016-05-11 18:04:22 UTC) #8
yzshen1
https://codereview.chromium.org/1966933002/diff/40001/url/mojo/origin_struct_traits.h File url/mojo/origin_struct_traits.h (right): https://codereview.chromium.org/1966933002/diff/40001/url/mojo/origin_struct_traits.h#newcode29 url/mojo/origin_struct_traits.h:29: if (data.is_null()) { On 2016/05/11 18:04:22, dcheng wrote: > ...
4 years, 7 months ago (2016-05-11 18:18:25 UTC) #9
jam
lgtm
4 years, 7 months ago (2016-05-11 19:24:23 UTC) #10
dcheng
How is code supposed to distinguish between a null Origin and a unique Origin? I ...
4 years, 7 months ago (2016-05-11 21:19:57 UTC) #11
Ken Rockot(use gerrit already)
On May 11, 2016 2:19 PM, <dcheng@chromium.org> wrote: > > How is code supposed to ...
4 years, 7 months ago (2016-05-11 21:27:40 UTC) #12
dcheng
On 2016/05/11 at 21:27:40, rockot wrote: > On May 11, 2016 2:19 PM, <dcheng@chromium.org> wrote: ...
4 years, 7 months ago (2016-05-11 21:33:26 UTC) #13
Ken Rockot(use gerrit already)
On 2016/05/11 at 21:33:26, dcheng wrote: > On 2016/05/11 at 21:27:40, rockot wrote: > > ...
4 years, 7 months ago (2016-05-11 21:45:32 UTC) #14
yzshen1
We don't support different type mapping for T and T? (nullable T) at the moment. ...
4 years, 7 months ago (2016-05-11 23:29:48 UTC) #15
dcheng
On 2016/05/11 at 23:29:48, yzshen wrote: > We don't support different type mapping for T ...
4 years, 7 months ago (2016-05-11 23:35:30 UTC) #16
Ken Rockot(use gerrit already)
On 2016/05/11 at 23:35:30, dcheng wrote: > On 2016/05/11 at 23:29:48, yzshen wrote: > > ...
4 years, 7 months ago (2016-05-11 23:42:46 UTC) #17
Ken Rockot(use gerrit already)
On 2016/05/11 at 23:42:46, Ken Rockot wrote: > On 2016/05/11 at 23:35:30, dcheng wrote: > ...
4 years, 7 months ago (2016-05-11 23:47:09 UTC) #18
yzshen1
On 2016/05/11 23:35:30, dcheng wrote: > On 2016/05/11 at 23:29:48, yzshen wrote: > > We ...
4 years, 7 months ago (2016-05-12 00:06:01 UTC) #19
dcheng
On 2016/05/12 at 00:06:01, yzshen wrote: > On 2016/05/11 23:35:30, dcheng wrote: > > On ...
4 years, 7 months ago (2016-05-12 00:09:56 UTC) #20
dcheng
On 2016/05/12 at 00:09:56, dcheng wrote: > On 2016/05/12 at 00:06:01, yzshen wrote: > > ...
4 years, 7 months ago (2016-05-12 03:01:23 UTC) #21
yzshen1
On 2016/05/12 03:01:23, dcheng wrote: > On 2016/05/12 at 00:09:56, dcheng wrote: > > On ...
4 years, 7 months ago (2016-05-12 05:55:49 UTC) #22
yzshen1
Hi, Daniel. I have updated the CL according to our discussion. Please take another look. ...
4 years, 7 months ago (2016-05-12 23:10:06 UTC) #23
dcheng
LGTM with one question. https://codereview.chromium.org/1966933002/diff/80001/mojo/public/cpp/bindings/string_traits_string_piece.h File mojo/public/cpp/bindings/string_traits_string_piece.h (right): https://codereview.chromium.org/1966933002/diff/80001/mojo/public/cpp/bindings/string_traits_string_piece.h#newcode15 mojo/public/cpp/bindings/string_traits_string_piece.h:15: static bool IsNull(const base::StringPiece& input) ...
4 years, 7 months ago (2016-05-13 04:12:34 UTC) #24
yzshen1
Thanks! https://codereview.chromium.org/1966933002/diff/80001/mojo/public/cpp/bindings/string_traits_string_piece.h File mojo/public/cpp/bindings/string_traits_string_piece.h (right): https://codereview.chromium.org/1966933002/diff/80001/mojo/public/cpp/bindings/string_traits_string_piece.h#newcode15 mojo/public/cpp/bindings/string_traits_string_piece.h:15: static bool IsNull(const base::StringPiece& input) { On 2016/05/13 ...
4 years, 7 months ago (2016-05-13 04:35:08 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1966933002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1966933002/80001
4 years, 7 months ago (2016-05-13 04:35:33 UTC) #28
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 7 months ago (2016-05-13 04:42:35 UTC) #29
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/2017646cf12650e54c22fab5195dfb225617a009 Cr-Commit-Position: refs/heads/master@{#393448}
4 years, 7 months ago (2016-05-13 04:44:19 UTC) #31
dcheng
4 years, 7 months ago (2016-05-13 06:05:16 UTC) #32
Message was sent while issue was closed.
https://codereview.chromium.org/1966933002/diff/80001/mojo/public/cpp/binding...
File mojo/public/cpp/bindings/string_traits_string_piece.h (right):

https://codereview.chromium.org/1966933002/diff/80001/mojo/public/cpp/binding...
mojo/public/cpp/bindings/string_traits_string_piece.h:15: static bool
IsNull(const base::StringPiece& input) {
On 2016/05/13 at 04:35:08, yzshen1 wrote:
> On 2016/05/13 04:12:34, dcheng wrote:
> > Usually, StringPiece should be passed by value. Any idea if it makes any
codegen
> > difference here? 
> It still works if I change this method's signature to
> static bool IsNull(base::StringPiece input);
> But I think it is good to keep it consistent with other StructTraits, which
all use const& for the IsNull() method. WDYT?
> 
> > Since this is a simple inlined template, maybe it's not needed?
> I am not quite sure which do you mean:
> (1) the IsNull() method is not needed; or
> (2) the whole StringTraits for base::StringPiece is not needed.
> 
> WRT (1): Yes, IsNull() could be omitted to mean "never null". I slightly
prefer to define either both IsNull() and SetToNull(), or none of them.
> 
> WRT (2): This StringTraits is useful. Without it you cannot return
base::StringPiece from a StructTraits field getter; or read a string from a
DataView input data as base::StringPiece directly. 
> 
> Line 39 of
https://codereview.chromium.org/1966933002/diff/80001/mojo/public/cpp/binding...
> 
> Line 17 of
>
https://codereview.chromium.org/1966933002/diff/80001/mojo/public/cpp/binding...
> 
> (I will definitely update our doc to talk about things like this. :))

To clarify, my comment was only referring to using StringPiece instead of const
StringPiece& for the parameter name. More documentation is always good though =)

Powered by Google App Engine
This is Rietveld 408576698