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

Issue 1751563002: Mojo C++ bindings: support mapping mojo string to WTF::String. (Closed)

Created:
4 years, 9 months ago by yzshen1
Modified:
4 years, 6 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, rouslan+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mojo C++ bindings: support mapping mojo string to WTF::String. The generator now supports a "--for_blink" flag. When it is specified, the generator will map mojo string to WTF::String. BUG=583738 Committed: https://crrev.com/791f9b24ca1758ced39235bda1a4e0411801309c Cr-Commit-Position: refs/heads/master@{#381091}

Patch Set 1 #

Patch Set 2 : #

Total comments: 7

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : deal with 16-bit WTF::Strings #

Patch Set 6 : #

Total comments: 12

Patch Set 7 : #

Patch Set 8 : #

Total comments: 2

Patch Set 9 : #

Patch Set 10 : #

Total comments: 3

Patch Set 11 : #

Patch Set 12 : #

Total comments: 2

Patch Set 13 : #

Patch Set 14 : sync & rebase #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+574 lines, -44 lines) Patch
M mojo/mojo_edk_tests.gyp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +15 lines, -0 lines 0 comments Download
M mojo/mojo_public.gyp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +50 lines, -0 lines 1 comment Download
M mojo/mojom_bindings_generator.gypi View 1 2 4 chunks +17 lines, -0 lines 0 comments Download
M mojo/mojom_bindings_generator_explicit.gypi View 1 2 4 chunks +19 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +19 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/DEPS View 1 chunk +3 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/array_serialization_traits.h View 1 2 3 4 2 chunks +6 lines, -1 line 0 comments Download
M mojo/public/cpp/bindings/lib/bindings_internal.h View 2 chunks +8 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/bindings_serialization.h View 1 2 3 4 2 chunks +7 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/lib/serialization_forward.h View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
A mojo/public/cpp/bindings/lib/wtf_serialization.h View 1 chunk +10 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/wtf_string_serialization.h View 1 2 3 4 1 chunk +28 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/lib/wtf_string_serialization.cc View 1 2 3 4 5 6 7 8 9 1 chunk +119 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +18 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/tests/pickle_unittest.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +1 line, -15 lines 0 comments Download
M mojo/public/cpp/bindings/tests/struct_traits_unittest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +1 line, -13 lines 0 comments Download
A mojo/public/cpp/bindings/tests/variant_test_util.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +32 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/tests/wtf_types_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +134 lines, -0 lines 0 comments Download
M mojo/public/interfaces/bindings/tests/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 1 chunk +23 lines, -0 lines 0 comments Download
A mojo/public/interfaces/bindings/tests/test_wtf_types.mojom View 4 1 chunk +14 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 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 9 10 1 chunk +5 lines, -1 line 0 comments Download
M mojo/public/tools/bindings/generators/mojom_cpp_generator.py View 1 2 3 4 5 6 7 8 9 10 8 chunks +12 lines, -7 lines 0 comments Download
M mojo/public/tools/bindings/mojom.gni View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +10 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/mojom_bindings_generator.py View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M mojo/public/tools/bindings/pylib/mojom/generate/generator.py View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/blink_platform_tests.gyp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 62 (11 generated)
yzshen1
Hi, Would you please take a look? Thanks! Ken: everything Kentaro: - mojo/public/cpp/bindings/DEPS: OWNER review ...
4 years, 9 months ago (2016-02-29 21:16:31 UTC) #2
haraken
https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode18 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:18: DCHECK(input.is8Bit()); From the perspective of Blink, in common cases ...
4 years, 9 months ago (2016-03-01 00:40:54 UTC) #3
yzshen1
https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode18 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:18: DCHECK(input.is8Bit()); On 2016/03/01 00:40:54, haraken wrote: > > From ...
4 years, 9 months ago (2016-03-01 00:51:53 UTC) #4
haraken
https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode18 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:18: DCHECK(input.is8Bit()); On 2016/03/01 00:51:53, yzshen1 wrote: > On 2016/03/01 ...
4 years, 9 months ago (2016-03-01 01:56:46 UTC) #5
esprehn
https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode18 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:18: DCHECK(input.is8Bit()); wtf::String is 16 bit for many cases, the ...
4 years, 9 months ago (2016-03-01 02:03:32 UTC) #6
Ken Rockot(use gerrit already)
change in general LG to me but I'll hold off stamping until the blink string ...
4 years, 9 months ago (2016-03-01 02:06:37 UTC) #7
yzshen1
https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/20001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode18 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:18: DCHECK(input.is8Bit()); On 2016/03/01 02:03:32, esprehn wrote: > wtf::String is ...
4 years, 9 months ago (2016-03-01 17:32:02 UTC) #8
yzshen1
https://codereview.chromium.org/1751563002/diff/20001/mojo/public/tools/bindings/mojom.gni File mojo/public/tools/bindings/mojom.gni (right): https://codereview.chromium.org/1751563002/diff/20001/mojo/public/tools/bindings/mojom.gni#newcode68 mojo/public/tools/bindings/mojom.gni:68: # use_wtf_types (optional, C++ only) On 2016/03/01 02:06:37, Ken ...
4 years, 9 months ago (2016-03-01 18:42:46 UTC) #9
darin (slow to review)
It makes me nervous to not ensure that string in mojom is always UTF-8. We ...
4 years, 9 months ago (2016-03-01 19:13:29 UTC) #10
yzshen1
On 2016/03/01 19:13:29, darin (slow to review) wrote: > It makes me nervous to not ...
4 years, 9 months ago (2016-03-01 19:23:09 UTC) #11
esprehn
I don't want mojo::String conversion costs except at the IPC boundary (when you actually call ...
4 years, 9 months ago (2016-03-01 19:51:14 UTC) #12
Ken Rockot(use gerrit already)
I think doing the conversion to/from UTF8 at the serialization boundary makes sense, as it's ...
4 years, 9 months ago (2016-03-01 20:10:43 UTC) #13
yzshen1
On 2016/03/01 19:51:14, esprehn wrote: > I don't want mojo::String conversion costs except at the ...
4 years, 9 months ago (2016-03-01 20:21:06 UTC) #14
esprehn
On 2016/03/01 at 20:21:06, yzshen wrote: > On 2016/03/01 19:51:14, esprehn wrote: > > I ...
4 years, 9 months ago (2016-03-01 20:51:10 UTC) #15
esprehn
On 2016/03/01 at 20:51:10, esprehn wrote: > On 2016/03/01 at 20:21:06, yzshen wrote: > > ...
4 years, 9 months ago (2016-03-01 20:53:29 UTC) #16
yzshen1
I had a chat with Elliot. It turned out that WTF::String doesn't support utf8 representation, ...
4 years, 9 months ago (2016-03-01 21:42:32 UTC) #17
yzshen1
Hi, reviewers. This CL now can deal with 16-bit WTF::Strings. PTAL. Thanks!
4 years, 9 months ago (2016-03-03 20:18:48 UTC) #18
Ken Rockot(use gerrit already)
LGTM!
4 years, 9 months ago (2016-03-04 00:26:05 UTC) #19
haraken
https://codereview.chromium.org/1751563002/diff/100001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/100001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode37 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:37: std::queue<UTF8AdaptorWithPointer> utf8_adaptors_; Just help me understand: Why do we ...
4 years, 9 months ago (2016-03-04 04:04:50 UTC) #20
esprehn
Hmmm, this means allowing usage of WTF out in mojo which is very strange, I ...
4 years, 9 months ago (2016-03-04 04:14:48 UTC) #21
esprehn
fwiw instead of checking that the original_string is the same, I'd check that the value ...
4 years, 9 months ago (2016-03-04 04:16:09 UTC) #22
yzshen1
> fwiw instead of checking that the original_string is the same, I'd check that > ...
4 years, 9 months ago (2016-03-04 17:28:49 UTC) #23
haraken
https://codereview.chromium.org/1751563002/diff/100001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/100001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode37 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:37: std::queue<UTF8AdaptorWithPointer> utf8_adaptors_; On 2016/03/04 17:28:49, yzshen1 wrote: > On ...
4 years, 9 months ago (2016-03-07 02:04:29 UTC) #26
yzshen1
Thanks! PTAL. https://codereview.chromium.org/1751563002/diff/100001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/100001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode37 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:37: std::queue<UTF8AdaptorWithPointer> utf8_adaptors_; On 2016/03/07 02:04:29, haraken wrote: ...
4 years, 9 months ago (2016-03-07 18:26:47 UTC) #27
haraken
https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc File mojo/public/cpp/bindings/tests/wtf_test_base.cc (right): https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc#newcode36 mojo/public/cpp/bindings/tests/wtf_test_base.cc:36: g_wtf_initialized = true; Can we use blink::initializeWithoutV8/shutdownWithoutV8? The reason ...
4 years, 9 months ago (2016-03-07 23:54:17 UTC) #28
yzshen1
https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc File mojo/public/cpp/bindings/tests/wtf_test_base.cc (right): https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc#newcode36 mojo/public/cpp/bindings/tests/wtf_test_base.cc:36: g_wtf_initialized = true; On 2016/03/07 23:54:17, haraken wrote: > ...
4 years, 9 months ago (2016-03-08 00:17:09 UTC) #29
haraken
https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc File mojo/public/cpp/bindings/tests/wtf_test_base.cc (right): https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc#newcode36 mojo/public/cpp/bindings/tests/wtf_test_base.cc:36: g_wtf_initialized = true; On 2016/03/08 00:17:09, yzshen1 wrote: > ...
4 years, 9 months ago (2016-03-08 00:29:29 UTC) #30
yzshen1
On 2016/03/08 00:29:29, haraken wrote: > https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc > File mojo/public/cpp/bindings/tests/wtf_test_base.cc (right): > > https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc#newcode36 > ...
4 years, 9 months ago (2016-03-08 00:48:27 UTC) #31
haraken
On 2016/03/08 00:48:27, yzshen1 wrote: > On 2016/03/08 00:29:29, haraken wrote: > > > https://codereview.chromium.org/1751563002/diff/180001/mojo/public/cpp/bindings/tests/wtf_test_base.cc ...
4 years, 9 months ago (2016-03-08 00:58:52 UTC) #32
yzshen1
On 2016/03/08 00:58:52, haraken wrote: > On 2016/03/08 00:48:27, yzshen1 wrote: > > On 2016/03/08 ...
4 years, 9 months ago (2016-03-08 02:04:05 UTC) #33
haraken
On 2016/03/08 02:04:05, yzshen1 wrote: > On 2016/03/08 00:58:52, haraken wrote: > > On 2016/03/08 ...
4 years, 9 months ago (2016-03-08 02:36:15 UTC) #34
yzshen1
On 2016/03/08 02:36:15, haraken wrote: > On 2016/03/08 02:04:05, yzshen1 wrote: > > On 2016/03/08 ...
4 years, 9 months ago (2016-03-08 04:01:35 UTC) #35
haraken
On 2016/03/08 04:01:35, yzshen1 wrote: > On 2016/03/08 02:36:15, haraken wrote: > > On 2016/03/08 ...
4 years, 9 months ago (2016-03-08 04:10:03 UTC) #36
esprehn
The more I think about this the more I think we really want this code ...
4 years, 9 months ago (2016-03-10 19:50:10 UTC) #37
yzshen1
On 2016/03/10 19:50:10, esprehn wrote: > The more I think about this the more I ...
4 years, 9 months ago (2016-03-10 20:38:44 UTC) #38
haraken
On 2016/03/10 20:38:44, yzshen1 wrote: > On 2016/03/10 19:50:10, esprehn wrote: > > The more ...
4 years, 9 months ago (2016-03-10 23:57:11 UTC) #39
haraken
On 2016/03/10 23:57:11, haraken wrote: > On 2016/03/10 20:38:44, yzshen1 wrote: > > On 2016/03/10 ...
4 years, 9 months ago (2016-03-11 09:08:09 UTC) #40
yzshen1
Thanks Kentaro! After some more thoughts, I made the Mojo WTF-related tests a source_set/static_library, and ...
4 years, 9 months ago (2016-03-11 19:08:59 UTC) #41
esprehn
On 2016/03/11 at 19:08:59, yzshen wrote: > Thanks Kentaro! > > After some more thoughts, ...
4 years, 9 months ago (2016-03-11 22:29:56 UTC) #42
haraken
Sorry for blocking your work with the testing issues and thanks for being persistent! LGTM. ...
4 years, 9 months ago (2016-03-13 16:21:07 UTC) #43
yzshen1
Thanks Kentaro for your suggestions. :) https://codereview.chromium.org/1751563002/diff/220001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc File mojo/public/cpp/bindings/lib/wtf_string_serialization.cc (right): https://codereview.chromium.org/1751563002/diff/220001/mojo/public/cpp/bindings/lib/wtf_string_serialization.cc#newcode89 mojo/public/cpp/bindings/lib/wtf_string_serialization.cc:89: #if DCHECK_IS_ON() On ...
4 years, 9 months ago (2016-03-14 06:36:27 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1751563002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1751563002/220001
4 years, 9 months ago (2016-03-14 06:36:58 UTC) #47
commit-bot: I haz the power
Try jobs failed on following builders: ios_rel_device_gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_gn/builds/4075)
4 years, 9 months ago (2016-03-14 06:43:43 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1751563002/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1751563002/260001
4 years, 9 months ago (2016-03-14 20:49:06 UTC) #52
commit-bot: I haz the power
Committed patchset #14 (id:260001)
4 years, 9 months ago (2016-03-14 22:26:36 UTC) #54
commit-bot: I haz the power
Patchset 14 (id:??) landed as https://crrev.com/791f9b24ca1758ced39235bda1a4e0411801309c Cr-Commit-Position: refs/heads/master@{#381091}
4 years, 9 months ago (2016-03-14 22:28:37 UTC) #56
loyso (OOO)
Is this CL related to linux_blink_rel failures on trybots? https://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/83713 ./blink_platform_unittests: error while loading shared ...
4 years, 9 months ago (2016-03-15 02:10:06 UTC) #57
yzshen1
Thanks for informing me of this! Yes, it is related. I am now looking at ...
4 years, 9 months ago (2016-03-15 02:41:50 UTC) #58
yzshen1
I have landed a fix for it: https://codereview.chromium.org/1800843003/ I will keep an eye on the ...
4 years, 9 months ago (2016-03-15 03:10:11 UTC) #59
Nico
I agree with Elliot that it looks very surprising that code not in blink depends ...
4 years, 6 months ago (2016-06-06 14:27:48 UTC) #61
yzshen1
4 years, 6 months ago (2016-06-06 19:33:04 UTC) #62
Message was sent while issue was closed.
On 2016/06/06 14:27:48, Nico wrote:
> I agree with Elliot that it looks very surprising that code not in blink
depends
> on blink internals like wtf. mojo is the only project doing this:
>
https://cs.chromium.org/search/?q=wtf+file:gyp+-file:third_party/webkit&sq=pa...
> 
> Was this discussed with platform-architecture-dev somewhere? Neither BUG= nor
CL
> description nor an in-code comment point at any discussion about this.
> 

The code referred to wtf in mojo is only used in blink, but not anywhere outside
of it.
It was discussed in person with Kentaro and Elliot.

There is a refactoring in progress that will allow us to eventually move
wtf-related code into blink.
https://bugs.chromium.org/p/chromium/issues/detail?id=577686

I have also filed bug crbug.com/617718 explicitly talking about removing this
dependency.

> https://codereview.chromium.org/1751563002/diff/260001/mojo/mojo_public.gyp
> File mojo/mojo_public.gyp (right):
> 
>
https://codereview.chromium.org/1751563002/diff/260001/mojo/mojo_public.gyp#n...
> mojo/mojo_public.gyp:222: 'clang_warning_flags_unset': [
'-Wglobal-constructors'
> ],
> this looks incorrect. why do you need this?

That is because gtest cannot compile with this flag. I have uploaded a CL to
unset the flag only for unittests.

Please review: https://codereview.chromium.org/2038413003/

Thanks!

Powered by Google App Engine
This is Rietveld 408576698