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

Issue 1956113002: [ios Mojo] iOS facade class for Mojo API. (Closed)

Created:
4 years, 7 months ago by Eugene But (OOO till 7-30)
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@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[ios Mojo] iOS facade class for Mojo API. On all platforms except iOS Mojo API is implemented natively. On iOS Chrome is not allowed to use Bling and uses WKWebView. So the only way to implement Mojo API is hybrid approach: - API frontent is implemented in JS; - frontend packs function name and arguments into JSON and sends to the native code; - window.prompt is used as communication channel, because this is the only way to send synchronous message from WKWebView; - native code will pass JSON to facade; - facade will respond with JSON; - native code will send JSON back to JS via window.prompt result; - JS frontent will unpack JSON and will return the result to the caller; This CL introduces a facade class which takes JSON as in input, passes it to Mojo and then returns the result as JSON. Design doc: https://docs.google.com/document/d/1iUJXX_zoY2BbnecpfxjznOeasf29KUzl_9S_LG08Bes/edit#heading=h.yjqp5garsqf9 BUG=567809 Committed: https://crrev.com/91b474353e27a83bd990556572418c2c9750abed Cr-Commit-Position: refs/heads/master@{#394313}

Patch Set 1 #

Total comments: 11

Patch Set 2 : CHECK on invalid arguments #

Patch Set 3 : Updated gyp files #

Total comments: 2

Patch Set 4 : Created GN file #

Patch Set 5 : Fixed compilation #

Patch Set 6 : Updated web gn file #

Patch Set 7 : More updates to gn. #

Total comments: 5

Patch Set 8 : Switched to C++ API; Implemented support.cancelWatch; #

Patch Set 9 : Self review #

Total comments: 4

Patch Set 10 : Tests for Read/Write/Watch #

Total comments: 2

Patch Set 11 : Moved Mojo initialization to ios/web/test/run_all_unittests.cc #

Total comments: 2

Patch Set 12 : Removed //mojo/public:sdk usage. #

Total comments: 17

Patch Set 13 : Updated the comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+745 lines, -2 lines) Patch
M ios/web/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +7 lines, -0 lines 0 comments Download
M ios/web/DEPS View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M ios/web/ios_web.gyp View 1 2 3 4 5 6 7 4 chunks +35 lines, -0 lines 0 comments Download
M ios/web/ios_web_unittests.gyp View 1 chunk +1 line, -0 lines 0 comments Download
A + ios/web/test/BUILD.gn View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
A ios/web/test/mojo_test.mojom View 1 chunk +15 lines, -0 lines 0 comments Download
M ios/web/test/run_all_unittests.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M ios/web/webui/DEPS View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
A ios/web/webui/mojo_facade.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +139 lines, -0 lines 0 comments Download
A ios/web/webui/mojo_facade.mm View 1 2 3 4 5 6 7 8 9 1 chunk +267 lines, -0 lines 0 comments Download
A ios/web/webui/mojo_facade_unittest.mm View 1 2 3 4 5 6 7 8 9 10 1 chunk +273 lines, -0 lines 0 comments Download

Messages

Total messages: 64 (25 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/1
4 years, 7 months ago (2016-05-06 23:20:03 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-device-gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-gn/builds/2037) ios-simulator on ...
4 years, 7 months ago (2016-05-06 23:26:18 UTC) #4
Eugene But (OOO till 7-30)
PTAL. This is backend for iOS Mojo API. I will send frontent in a separate ...
4 years, 7 months ago (2016-05-07 00:07:52 UTC) #8
Ken Rockot(use gerrit already)
Not a full review, just some high-level comments/questions for now https://codereview.chromium.org/1956113002/diff/1/ios/web/ios_web.gyp File ios/web/ios_web.gyp (right): https://codereview.chromium.org/1956113002/diff/1/ios/web/ios_web.gyp#newcode56 ...
4 years, 7 months ago (2016-05-09 15:44:38 UTC) #9
Eugene But (OOO till 7-30)
Replying to one comment. Will address others separately. https://codereview.chromium.org/1956113002/diff/1/ios/web/webui/mojo_facade.mm File ios/web/webui/mojo_facade.mm (right): https://codereview.chromium.org/1956113002/diff/1/ios/web/webui/mojo_facade.mm#newcode122 ios/web/webui/mojo_facade.mm:122: return ...
4 years, 7 months ago (2016-05-09 16:08:10 UTC) #10
Ken Rockot(use gerrit already)
On 2016/05/09 at 16:08:10, eugenebut wrote: > Replying to one comment. Will address others separately. ...
4 years, 7 months ago (2016-05-09 16:11:57 UTC) #11
Eugene But (OOO till 7-30)
Still have to update GN version. But I'm not sure how to implement GYP correctly ...
4 years, 7 months ago (2016-05-10 02:00:56 UTC) #12
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/40001
4 years, 7 months ago (2016-05-12 16:41:09 UTC) #14
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/60001
4 years, 7 months ago (2016-05-12 16:43:04 UTC) #17
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-device-gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-gn/builds/4551) ios-simulator-gn on ...
4 years, 7 months ago (2016-05-12 16:48:55 UTC) #19
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/80001
4 years, 7 months ago (2016-05-12 17:28:59 UTC) #21
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-device-gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-gn/builds/4582)
4 years, 7 months ago (2016-05-12 17:39:39 UTC) #23
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/100001
4 years, 7 months ago (2016-05-12 19:49:33 UTC) #25
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-simulator-gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-gn/builds/4701)
4 years, 7 months ago (2016-05-12 19:56:51 UTC) #27
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/120001
4 years, 7 months ago (2016-05-12 20:20:06 UTC) #29
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-device-gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-gn/builds/4703)
4 years, 7 months ago (2016-05-12 20:32:54 UTC) #31
Eugene But (OOO till 7-30)
https://codereview.chromium.org/1956113002/diff/1/ios/web/ios_web.gyp File ios/web/ios_web.gyp (right): https://codereview.chromium.org/1956113002/diff/1/ios/web/ios_web.gyp#newcode56 ios/web/ios_web.gyp:56: '../../services/shell/shell.gyp:shell_public', On 2016/05/09 15:44:37, Ken Rockot wrote: > On ...
4 years, 7 months ago (2016-05-12 20:48:10 UTC) #32
Ken Rockot(use gerrit already)
Was just looking at that GN failure. I think you may unfortunately have to sprinkle ...
4 years, 7 months ago (2016-05-12 21:13:06 UTC) #33
Eugene But (OOO till 7-30)
Thanks! Using C++ library allowed to throw away a singleton, which is great. I switched ...
4 years, 7 months ago (2016-05-13 02:54:26 UTC) #34
Ken Rockot(use gerrit already)
Looks great, just some nits. Also would it be possible for you to test message ...
4 years, 7 months ago (2016-05-13 15:21:45 UTC) #35
Eugene But (OOO till 7-30)
Write tests for Read, Write, Watch. Let me know if you think that I need ...
4 years, 7 months ago (2016-05-14 00:05:09 UTC) #36
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/180001
4 years, 7 months ago (2016-05-14 04:03:05 UTC) #38
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-simulator-gn on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-gn/builds/5640)
4 years, 7 months ago (2016-05-14 04:10:42 UTC) #40
Ken Rockot(use gerrit already)
CancelWatch isn't easy to test and it's a pretty simple implementation here, so I don't ...
4 years, 7 months ago (2016-05-15 02:06:41 UTC) #41
Eugene But (OOO till 7-30)
Thanks! +Jackie https://codereview.chromium.org/1956113002/diff/180001/ios/web/webui/mojo_facade_unittest.mm File ios/web/webui/mojo_facade_unittest.mm (right): https://codereview.chromium.org/1956113002/diff/180001/ios/web/webui/mojo_facade_unittest.mm#newcode66 ios/web/webui/mojo_facade_unittest.mm:66: mojo::edk::Init(); On 2016/05/15 02:06:41, Ken Rockot wrote: ...
4 years, 7 months ago (2016-05-16 16:14:57 UTC) #43
Ken Rockot(use gerrit already)
Oh right - I guess we explicitly forbid direct dependency on //mojo/edk/embedder. My bad. this ...
4 years, 7 months ago (2016-05-16 16:22:23 UTC) #44
Eugene But (OOO till 7-30)
https://codereview.chromium.org/1956113002/diff/200001/ios/web/BUILD.gn File ios/web/BUILD.gn (right): https://codereview.chromium.org/1956113002/diff/200001/ios/web/BUILD.gn#newcode18 ios/web/BUILD.gn:18: "//mojo/public:sdk", On 2016/05/16 16:22:23, Ken Rockot wrote: > Hmm ...
4 years, 7 months ago (2016-05-16 16:40:02 UTC) #45
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/220001
4 years, 7 months ago (2016-05-16 18:39:53 UTC) #47
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 7 months ago (2016-05-16 19:56:26 UTC) #49
Jackie Quinn
Some comments on commenting and some questions about how things work. https://codereview.chromium.org/1956113002/diff/220001/ios/web/ios_web.gyp File ios/web/ios_web.gyp (right): ...
4 years, 7 months ago (2016-05-16 22:28:17 UTC) #50
Eugene But (OOO till 7-30)
Thanks! PTAL https://codereview.chromium.org/1956113002/diff/220001/ios/web/ios_web.gyp File ios/web/ios_web.gyp (right): https://codereview.chromium.org/1956113002/diff/220001/ios/web/ios_web.gyp#newcode506 ios/web/ios_web.gyp:506: 'target_name': 'test_mojo_bindings_mojom', On 2016/05/16 22:28:16, Jackie Quinn ...
4 years, 7 months ago (2016-05-16 23:39:59 UTC) #51
Jackie Quinn
lgtm https://codereview.chromium.org/1956113002/diff/220001/ios/web/ios_web.gyp File ios/web/ios_web.gyp (right): https://codereview.chromium.org/1956113002/diff/220001/ios/web/ios_web.gyp#newcode506 ios/web/ios_web.gyp:506: 'target_name': 'test_mojo_bindings_mojom', On 2016/05/16 23:39:58, Eugene But wrote: ...
4 years, 7 months ago (2016-05-17 23:07:06 UTC) #52
Eugene But (OOO till 7-30)
Thanks! https://codereview.chromium.org/1956113002/diff/220001/ios/web/ios_web.gyp File ios/web/ios_web.gyp (right): https://codereview.chromium.org/1956113002/diff/220001/ios/web/ios_web.gyp#newcode506 ios/web/ios_web.gyp:506: 'target_name': 'test_mojo_bindings_mojom', On 2016/05/17 23:07:06, Jackie Quinn wrote: ...
4 years, 7 months ago (2016-05-18 00:09:32 UTC) #53
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1956113002/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1956113002/240001
4 years, 7 months ago (2016-05-18 00:10:21 UTC) #56
commit-bot: I haz the power
Committed patchset #13 (id:240001)
4 years, 7 months ago (2016-05-18 01:59:07 UTC) #58
commit-bot: I haz the power
Patchset 13 (id:??) landed as https://crrev.com/91b474353e27a83bd990556572418c2c9750abed Cr-Commit-Position: refs/heads/master@{#394313}
4 years, 7 months ago (2016-05-18 02:00:39 UTC) #60
Nico
Together with https://codereview.chromium.org/1984353002/ , this broke the ios gn bots like so: https://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-gn/builds/7843/steps/generate_build_files%20%28without%20patch%29/logs/stdio ERROR at ...
4 years, 7 months ago (2016-05-18 17:28:26 UTC) #62
Eugene But (OOO till 7-30)
+baxley@, but this looks like already fixed. On Wed, May 18, 2016 at 10:28 AM, ...
4 years, 7 months ago (2016-05-18 18:24:08 UTC) #63
sdefresne
4 years, 7 months ago (2016-05-18 18:34:28 UTC) #64
Message was sent while issue was closed.
On 2016/05/18 18:24:08, Eugene But wrote:
> +baxley@, but this looks like already fixed.

thakis reverted my CL enabling "--check" for "//ios".

I've updated my CL with a fourth patchset to fix the regression introduced by
this CL, see https://codereview.chromium.org/1984353002/.

Powered by Google App Engine
This is Rietveld 408576698