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

Issue 959993002: Dart: Removes name conflicts from generated bindings. (Closed)

Created:
5 years, 10 months ago by zra
Modified:
5 years, 9 months ago
Reviewers:
hansmuller, hansmuller1, sky
CC:
mojo-reviews_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org, ojan, Elliot Glaysher, tonyg
Base URL:
git@github.com:domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Dart: Removes name conflicts from generated bindings. This change causes the generated abstract class having the same name as the interface to contain only the interface's method declarations. The generated Proxy class then implements the base class. In addition to implementing the interface methods, the generated Proxy class has one private field _proxyImpl, which is a MojoEventStreamListener and manages sending messages and receiving responses. Operations on the ProxyImpl (close, bind, etc.) are exposed through generated utility functions. The generated Stub is largely as before with the difference that a class providing a service will implement the mojo interface and *have* a Stub rather than be a Stub. Where appropriate, this change also calls listen() immediately where a Stub is constructed. BUG= R=hansmuller@google.com, sky@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/96af48303403d1a6d443f5c05f78b6e9480be9c3

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 2

Patch Set 5 : Remove generated toplevel functions #

Total comments: 2

Patch Set 6 : Remove interface tear-offs from Proxies #

Total comments: 2

Patch Set 7 : Renames Proxy.interface -> Proxy.ptr, adds close() cover method. #

Patch Set 8 : Removes unused constructors #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+294 lines, -243 lines) Patch
M examples/dart/console_example/main.dart View 1 2 3 4 5 6 1 chunk +7 lines, -8 lines 0 comments Download
M examples/dart/hello_world/hello/main.dart View 1 chunk +1 line, -2 lines 0 comments Download
M examples/dart/hello_world/world/main.dart View 1 chunk +1 line, -2 lines 0 comments Download
M examples/dart/wget/main.dart View 1 2 3 4 5 6 3 chunks +8 lines, -9 lines 0 comments Download
M mojo/dart/embedder/test/dart_to_cpp_tests.dart View 1 2 3 4 5 6 4 chunks +11 lines, -9 lines 0 comments Download
M mojo/dart/test/bindings_generation_test.dart View 1 2 3 4 5 6 3 chunks +15 lines, -11 lines 0 comments Download
M mojo/dart/test/validation_test.dart View 1 2 3 4 5 3 chunks +12 lines, -7 lines 0 comments Download
M mojo/public/dart/src/application.dart View 1 2 3 4 5 6 2 chunks +21 lines, -20 lines 0 comments Download
M mojo/public/dart/src/application_connection.dart View 1 2 3 4 5 6 5 chunks +28 lines, -20 lines 0 comments Download
M mojo/public/dart/src/codec.dart View 1 2 3 4 3 chunks +4 lines, -4 lines 0 comments Download
M mojo/public/dart/src/event_stream.dart View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M mojo/public/dart/src/proxy.dart View 1 2 3 4 1 chunk +7 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl View 1 2 3 4 5 6 7 6 chunks +90 lines, -72 lines 2 comments Download
M services/dart/test/echo/main.dart View 3 chunks +9 lines, -7 lines 0 comments Download
M services/dart/test/pingpong/main.dart View 1 2 3 4 5 6 3 chunks +43 lines, -37 lines 0 comments Download
M services/dart/test/pingpong_target/main.dart View 1 2 3 4 5 6 3 chunks +17 lines, -14 lines 2 comments Download
M sky/framework/embedder.dart View 1 2 3 4 5 6 1 chunk +5 lines, -5 lines 0 comments Download
M sky/tests/resources/event-sender.dart View 1 2 3 4 5 6 3 chunks +4 lines, -4 lines 0 comments Download
M sky/tests/services/event-sender.sky View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M sky/tests/services/iframe-embed-vmc.sky View 1 2 3 4 5 6 2 chunks +3 lines, -4 lines 0 comments Download
M sky/tests/services/network.sky View 1 2 3 4 5 6 1 chunk +5 lines, -5 lines 0 comments Download

Messages

Total messages: 25 (2 generated)
zra
I want to merge in the bugfixes tonyg is working on before proceeding with this ...
5 years, 10 months ago (2015-02-26 00:12:39 UTC) #2
sky
On 2015/02/26 00:12:39, zra wrote: > I want to merge in the bugfixes tonyg is ...
5 years, 10 months ago (2015-02-26 00:51:50 UTC) #3
zra
On 2015/02/26 00:51:50, sky wrote: > I'm curious as to why you prefer this approach ...
5 years, 10 months ago (2015-02-26 15:22:29 UTC) #4
hansmuller1
On 2015/02/26 15:22:29, zra wrote: > On 2015/02/26 00:51:50, sky wrote: > > I'm curious ...
5 years, 10 months ago (2015-02-26 16:27:41 UTC) #5
zra
PTAL I've made a change so that the generated Proxy class has two fields, |impl| ...
5 years, 10 months ago (2015-02-26 18:06:20 UTC) #6
sky
https://codereview.chromium.org/959993002/diff/60001/mojo/dart/test/validation_test.dart File mojo/dart/test/validation_test.dart (right): https://codereview.chromium.org/959993002/diff/60001/mojo/dart/test/validation_test.dart#newcode20 mojo/dart/test/validation_test.dart:20: ConfrmanceTestInterfaceImpl(this._completer, You've got a mispelling here. https://codereview.chromium.org/959993002/diff/80001/examples/dart/console_example/main.dart File examples/dart/console_example/main.dart ...
5 years, 10 months ago (2015-02-26 18:21:15 UTC) #7
zra
https://codereview.chromium.org/959993002/diff/80001/examples/dart/console_example/main.dart File examples/dart/console_example/main.dart (right): https://codereview.chromium.org/959993002/diff/80001/examples/dart/console_example/main.dart#newcode14 examples/dart/console_example/main.dart:14: Console _console; On 2015/02/26 18:21:15, sky wrote: > I ...
5 years, 10 months ago (2015-02-26 19:33:58 UTC) #8
zra
https://codereview.chromium.org/959993002/diff/60001/mojo/dart/test/validation_test.dart File mojo/dart/test/validation_test.dart (right): https://codereview.chromium.org/959993002/diff/60001/mojo/dart/test/validation_test.dart#newcode20 mojo/dart/test/validation_test.dart:20: ConfrmanceTestInterfaceImpl(this._completer, On 2015/02/26 18:21:15, sky wrote: > You've got ...
5 years, 10 months ago (2015-02-26 19:58:30 UTC) #9
sky
https://codereview.chromium.org/959993002/diff/100001/examples/dart/wget/main.dart File examples/dart/wget/main.dart (right): https://codereview.chromium.org/959993002/diff/100001/examples/dart/wget/main.dart#newcode69 examples/dart/wget/main.dart:69: _networkService.impl.close(); Can we have a cover method for close, ...
5 years, 10 months ago (2015-02-26 20:47:37 UTC) #10
hansmuller1
This LGTM although time will tell if writing foo.interface.bar() is tedious, or likewise for forwarding ...
5 years, 10 months ago (2015-02-26 21:06:41 UTC) #12
hansmuller1
One other point (Scott suggested this as well): why bother with proxy.impl.close(), etc? Why not ...
5 years, 10 months ago (2015-02-26 21:31:55 UTC) #13
esprehn
On 2015/02/26 at 21:31:55, hansmuller wrote: > One other point (Scott suggested this as well): ...
5 years, 10 months ago (2015-02-26 21:43:32 UTC) #14
zra
On 2015/02/26 21:43:32, esprehn wrote: > It seems like Mojo API should live on > ...
5 years, 10 months ago (2015-02-26 22:04:16 UTC) #15
zra
I think having a shorter name to get at the calls is a good idea, ...
5 years, 10 months ago (2015-02-26 22:09:12 UTC) #16
sky
LGTM
5 years, 10 months ago (2015-02-26 22:53:09 UTC) #17
zra
Committed patchset #8 (id:140001) manually as 96af48303403d1a6d443f5c05f78b6e9480be9c3 (presubmit successful).
5 years, 10 months ago (2015-02-26 23:16:19 UTC) #18
zra
Thanks for the reviews!
5 years, 10 months ago (2015-02-26 23:16:45 UTC) #19
sky
https://codereview.chromium.org/959993002/diff/140001/services/dart/test/pingpong_target/main.dart File services/dart/test/pingpong_target/main.dart (right): https://codereview.chromium.org/959993002/diff/140001/services/dart/test/pingpong_target/main.dart#newcode19 services/dart/test/pingpong_target/main.dart:19: _stub = new PingPongServiceStub.fromEndpoint(endpoint) In looking at implementing this ...
5 years, 9 months ago (2015-02-27 17:00:22 UTC) #20
sky
https://codereview.chromium.org/959993002/diff/140001/services/dart/test/pingpong_target/main.dart File services/dart/test/pingpong_target/main.dart (right): https://codereview.chromium.org/959993002/diff/140001/services/dart/test/pingpong_target/main.dart#newcode19 services/dart/test/pingpong_target/main.dart:19: _stub = new PingPongServiceStub.fromEndpoint(endpoint) On 2015/02/27 17:00:22, sky wrote: ...
5 years, 9 months ago (2015-02-27 17:02:06 UTC) #21
hansmuller1
On 2015/02/26 23:16:45, zra wrote: > Thanks for the reviews! Having the Stub constructor listen() ...
5 years, 9 months ago (2015-02-27 18:41:32 UTC) #22
sky
https://codereview.chromium.org/959993002/diff/140001/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl File mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl (left): https://codereview.chromium.org/959993002/diff/140001/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl#oldcode23 mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl:23: stub.listen(onClosed: onClosed); Sorry, one last question. How do you ...
5 years, 9 months ago (2015-02-27 18:50:31 UTC) #23
zra
https://codereview.chromium.org/959993002/diff/140001/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl File mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl (left): https://codereview.chromium.org/959993002/diff/140001/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl#oldcode23 mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl:23: stub.listen(onClosed: onClosed); On 2015/02/27 18:50:31, sky wrote: > Sorry, ...
5 years, 9 months ago (2015-02-27 19:04:47 UTC) #24
zra
5 years, 9 months ago (2015-02-27 19:23:06 UTC) #25
Message was sent while issue was closed.
On 2015/02/27 18:41:32, hansmuller1 wrote:
> On 2015/02/26 23:16:45, zra wrote:
> > Thanks for the reviews!
> 
> Having the Stub constructor listen() by default seems like it would cover the
> common case and reduce mistakes. Maybe a special stub constructor that doesn't
> listen() by default, for the special case where you want to call listen()
later?

I'll add an optional named boolean argument called listen to the constructor
that defaults to true, and plumb it through.

Powered by Google App Engine
This is Rietveld 408576698