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

Issue 207503004: Mojo: add javascript bindings for request/response (Closed)

Created:
6 years, 9 months ago by darin (slow to review)
Modified:
6 years, 8 months ago
CC:
chromium-reviews, Aaron Boodman, viettrungluu+watch_chromium.org, ben+mojo_chromium.org
Visibility:
Public.

Description

Mojo: add javascript bindings for request/response If a mojom interface method specifies response parameters, then we'll generate javascript bindings that provide an additional callback parameter used to pass the response parameters. This mirrors the C++ implementation. A future improvement will likely be to use promises instead, especially now that they are enabled on trunk. As part of this CL, connector.js was also made consistent with connector.cc. It starts reading the message pipe immediately, handles write failures in a similar fashion, etc. The Connection type from connector.js is factored out into a separate file as it now holds a Router object. router.js mirrors router.cc. The Connection type is really the mirror of the C++ RemotePtr<S> type. Some basic request/response tests were added to connection_unittests.js. We'll probably want more testing. R=abarth@chromium.org, mpcomplete@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=259932

Patch Set 1 #

Patch Set 2 : add missing files #

Patch Set 3 : bring connector.js up to par with connector.cc #

Patch Set 4 : more generated code #

Patch Set 5 : with tests (and bug fixes) #

Patch Set 6 : --similarity=20 #

Total comments: 2

Patch Set 7 : fix style #

Total comments: 8

Patch Set 8 : fix per review feedback #

Patch Set 9 : --similarity=15 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+412 lines, -271 lines) Patch
A + mojo/apps/js/bindings/connection_unittests.js View 1 2 3 4 5 6 7 8 2 chunks +161 lines, -56 lines 0 comments Download
D mojo/apps/js/bindings/connector_unittests.js View 1 chunk +0 lines, -132 lines 0 comments Download
M mojo/apps/js/main.js View 4 chunks +5 lines, -5 lines 0 comments Download
M mojo/apps/js/test/run_apps_js_tests.cc View 3 4 1 chunk +4 lines, -4 lines 0 comments Download
M mojo/public/bindings/generators/js_templates/interface_definition.tmpl View 1 2 3 4 5 6 7 3 chunks +62 lines, -1 line 0 comments Download
M mojo/public/bindings/js/codec.js View 1 2 3 4 5 chunks +45 lines, -4 lines 0 comments Download
A + mojo/public/bindings/js/connection.js View 1 2 3 4 5 6 7 1 chunk +22 lines, -30 lines 0 comments Download
M mojo/public/bindings/js/connector.js View 1 2 3 4 5 6 7 3 chunks +36 lines, -30 lines 0 comments Download
A mojo/public/bindings/js/router.js View 1 2 3 4 5 6 7 1 chunk +75 lines, -0 lines 0 comments Download
M mojo/public/bindings/pylib/generate/mojom_generator.py View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/bindings/tests/sample_interfaces.mojom View 1 2 3 4 1 chunk +0 lines, -9 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
darin (slow to review)
6 years, 9 months ago (2014-03-26 08:16:20 UTC) #1
abarth-chromium
https://codereview.chromium.org/207503004/diff/120001/mojo/public/bindings/js/connector.js File mojo/public/bindings/js/connector.js (right): https://codereview.chromium.org/207503004/diff/120001/mojo/public/bindings/js/connector.js#newcode13 mojo/public/bindings/js/connector.js:13: this.drop_writes_ = false; dropWrites_ ? https://codereview.chromium.org/207503004/diff/120001/mojo/public/bindings/js/connector.js#newcode56 mojo/public/bindings/js/connector.js:56: drop_writes_ = ...
6 years, 9 months ago (2014-03-26 16:45:11 UTC) #2
darin (slow to review)
Thanks. I have to get used to writing JS code ;-) On Wed, Mar 26, ...
6 years, 9 months ago (2014-03-26 17:12:29 UTC) #3
Matt Perry
LGTM, small nits below https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/generators/js_templates/interface_definition.tmpl File mojo/public/bindings/generators/js_templates/interface_definition.tmpl (right): https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/generators/js_templates/interface_definition.tmpl#newcode57 mojo/public/bindings/generators/js_templates/interface_definition.tmpl:57: {%- if method.response_parameters == None ...
6 years, 9 months ago (2014-03-26 18:19:43 UTC) #4
abarth-chromium
https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/generators/js_templates/interface_definition.tmpl File mojo/public/bindings/generators/js_templates/interface_definition.tmpl (right): https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/generators/js_templates/interface_definition.tmpl#newcode15 mojo/public/bindings/generators/js_templates/interface_definition.tmpl:15: , closure Why not use promises instead of callbacks? ...
6 years, 9 months ago (2014-03-26 18:26:32 UTC) #5
abarth-chromium
https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/js/router.js File mojo/public/bindings/js/router.js (right): https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/js/router.js#newcode23 mojo/public/bindings/js/router.js:23: }; Should we drop the responders_ too?
6 years, 9 months ago (2014-03-26 19:05:45 UTC) #6
darin (slow to review)
Thanks for the feedback guys. I mentioned in the CL description that my plan is ...
6 years, 9 months ago (2014-03-27 00:19:49 UTC) #7
abarth-chromium
On 2014/03/27 00:19:49, darin wrote: > Thanks for the feedback guys. I mentioned in the ...
6 years, 9 months ago (2014-03-27 03:42:14 UTC) #8
darin (slow to review)
On 2014/03/26 18:19:43, Matt Perry wrote: > LGTM, small nits below > > https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/generators/js_templates/interface_definition.tmpl > ...
6 years, 9 months ago (2014-03-27 05:06:08 UTC) #9
darin (slow to review)
On 2014/03/26 18:26:32, abarth wrote: ... https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/generators/js_templates/interface_definition.tmpl#newcode39 > mojo/public/bindings/generators/js_templates/interface_definition.tmpl:39: var > response_params = > responseParams ...
6 years, 9 months ago (2014-03-27 05:11:10 UTC) #10
darin (slow to review)
On 2014/03/26 19:05:45, abarth wrote: > https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/js/router.js > File mojo/public/bindings/js/router.js (right): > > https://codereview.chromium.org/207503004/diff/170001/mojo/public/bindings/js/router.js#newcode23 > ...
6 years, 9 months ago (2014-03-27 05:15:22 UTC) #11
darin (slow to review)
The CQ bit was checked by darin@chromium.org
6 years, 9 months ago (2014-03-27 07:56:32 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/darin@chromium.org/207503004/210001
6 years, 9 months ago (2014-03-27 07:57:18 UTC) #13
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-27 09:22:54 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on linux_chromium_rel
6 years, 9 months ago (2014-03-27 09:22:55 UTC) #15
darin (slow to review)
The CQ bit was checked by darin@chromium.org
6 years, 8 months ago (2014-03-27 17:10:54 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/darin@chromium.org/207503004/210001
6 years, 8 months ago (2014-03-27 17:11:11 UTC) #17
darin (slow to review)
Committed patchset #9 manually as r259932 (presubmit successful).
6 years, 8 months ago (2014-03-27 18:13:33 UTC) #18
tkent
On 2014/03/27 18:13:33, darin wrote: > Committed patchset #9 manually as r259932 (presubmit successful). Let ...
6 years, 8 months ago (2014-03-28 00:41:08 UTC) #19
tkent
A revert of this CL has been created in https://codereview.chromium.org/215883004/ by tkent@chromium.org. The reason for ...
6 years, 8 months ago (2014-03-28 00:42:33 UTC) #20
darin (slow to review)
Hmm... an exception was already added to disable that test. The proper fix is in ...
6 years, 8 months ago (2014-03-28 00:48:52 UTC) #21
darin (slow to review)
6 years, 8 months ago (2014-03-28 05:50:59 UTC) #22
Message was sent while issue was closed.
On 2014/03/28 00:48:52, darin wrote:
> Hmm... an exception was already added to disable that test. The proper fix
> is in the CQ.
> On Mar 27, 2014 5:42 PM, <mailto:tkent@chromium.org> wrote:
> 
> > A revert of this CL has been created in
> > https://codereview.chromium.org/215883004/ by mailto:tkent@chromium.org.
> >
> > The reason for reverting is: broke WebUIMojoTest.EndToEnd test.
> > http://build.chromium.org/p/chromium.webkit/builders/
> > Linux%20Tests/builds/35528/steps/content_browsertests/logs/EndToEnd
> > .
> >
> > https://codereview.chromium.org/207503004/

Ah, but the exception was only made on Windows :-/

Powered by Google App Engine
This is Rietveld 408576698