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

Issue 718473003: Add mojo::Binding<Interface> for more flexible pipe<->impl binding (Closed)

Created:
6 years, 1 month ago by jamesr
Modified:
6 years, 1 month ago
Reviewers:
DaveMoore
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, sky, eseidel
Base URL:
git@github.com:domokit/mojo.git@master
Project:
mojo
Visibility:
Public.

Description

Add mojo::Binding<Interface> for more flexible pipe<->impl binding This provides a mojo::Binding<Interface> class that takes a pointer to an interface implementation and binds it to a pipe. This type can be composed into the interface implementation or managed separately, depending on the needs of the implementation. This is in contrast to InterfaceImpl<Interface> which uses implementation inheritance to store the binding with the pipe and thus forces the implementation into having a rigid relationship with the pipe. Binding<Interface> maps messages on the pipe to the interface and allows registering an error handler to be notified of connection errors but does not implement an error handling strategy itself. Deleting a Binding closes the pipe. StrongBinding<Interface> additionally deletes the interface on receiving a pipe error. InterfaceImpl<Interface> is rewritten in this patch to use a Binding<Interface> internally. I intend to transition all code away from using InterfaceImpl<Interface> to using Binding<Interface> directly, or if it's useful adding other helper classes for common patterns. I have a few examples of how this transition looks here: https://codereview.chromium.org/713313002 and here: https://codereview.chromium.org/718623004. BUG=431963 R=davemoore@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/43fd6836c314a82308f2d158a1ddc6588d6005bc

Patch Set 1 #

Patch Set 2 : rm weak_connector.h #

Patch Set 3 : #

Total comments: 15

Patch Set 4 : rename to Binding #

Patch Set 5 : #

Total comments: 1

Patch Set 6 : #

Patch Set 7 : add InterfaceRequest bind #

Patch Set 8 : Rename Binding::router() -> Binding::internal_router() #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+511 lines, -235 lines) Patch
M mojo/application_manager/application_manager.cc View 1 2 3 4 5 6 7 chunks +38 lines, -14 lines 0 comments Download
M mojo/application_manager/application_manager_unittest.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/cpp/bindings/BUILD.gn View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/binding.h View 1 2 3 4 5 6 7 1 chunk +136 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/interface_impl.h View 1 2 3 4 5 6 7 7 chunks +51 lines, -28 lines 1 comment Download
D mojo/public/cpp/bindings/lib/interface_impl_internal.h View 1 2 3 1 chunk +0 lines, -128 lines 1 comment Download
A mojo/public/cpp/bindings/strong_binding.h View 1 2 3 4 5 6 1 chunk +86 lines, -0 lines 1 comment Download
M mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc View 1 2 3 4 5 6 7 11 chunks +149 lines, -19 lines 0 comments Download
M mojo/public/cpp/bindings/tests/validation_unittest.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/mojo_public.gyp View 1 2 3 3 chunks +2 lines, -1 line 0 comments Download
M mojo/services/public/cpp/view_manager/lib/view_manager_client_factory.cc View 1 2 3 4 5 2 chunks +4 lines, -1 line 0 comments Download
M mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h View 1 2 2 chunks +2 lines, -3 lines 0 comments Download
M mojo/services/test_service/test_request_tracker_application.h View 1 2 2 chunks +8 lines, -6 lines 0 comments Download
M mojo/services/test_service/test_request_tracker_application.cc View 1 2 3 4 5 6 2 chunks +12 lines, -5 lines 0 comments Download
M mojo/services/test_service/test_request_tracker_impl.h View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M mojo/services/test_service/test_service_application.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M mojo/services/test_service/test_service_impl.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M mojo/services/test_service/test_service_impl.cc View 1 2 1 chunk +0 lines, -4 lines 0 comments Download
M mojo/services/test_service/test_time_service_impl.h View 1 2 3 4 5 6 3 chunks +6 lines, -2 lines 0 comments Download
M mojo/services/test_service/test_time_service_impl.cc View 1 2 3 4 5 6 1 chunk +4 lines, -2 lines 0 comments Download
M mojo/services/view_manager/view_manager_server_apptest.cc View 1 2 1 chunk +0 lines, -3 lines 0 comments Download
M mojo/services/view_manager/view_manager_unittest.cc View 1 2 3 4 5 6 7 3 chunks +6 lines, -8 lines 0 comments Download
M mojo/services/window_manager/window_manager_impl.h View 1 2 1 chunk +0 lines, -3 lines 0 comments Download
M mojo/services/window_manager/window_manager_impl.cc View 1 2 1 chunk +0 lines, -3 lines 0 comments Download

Messages

Total messages: 13 (1 generated)
jamesr
The problem this patch solves is that InterfaceImpl<> puts the router_/etc in a member variable ...
6 years, 1 month ago (2014-11-11 00:44:42 UTC) #2
jamesr
I agree the name collision is confusing. We should pick a good name for the ...
6 years, 1 month ago (2014-11-11 01:31:09 UTC) #3
DaveMoore
https://codereview.chromium.org/718473003/diff/40001/mojo/public/cpp/bindings/connector.h File mojo/public/cpp/bindings/connector.h (right): https://codereview.chromium.org/718473003/diff/40001/mojo/public/cpp/bindings/connector.h#newcode19 mojo/public/cpp/bindings/connector.h:19: // This connects an interface implementation a pipe. Deleting ...
6 years, 1 month ago (2014-11-11 17:18:45 UTC) #4
jamesr
https://codereview.chromium.org/718473003/diff/40001/mojo/public/cpp/bindings/interface_impl.h File mojo/public/cpp/bindings/interface_impl.h (left): https://codereview.chromium.org/718473003/diff/40001/mojo/public/cpp/bindings/interface_impl.h#oldcode41 mojo/public/cpp/bindings/interface_impl.h:41: virtual void OnConnectionEstablished() {} On 2014/11/11 17:18:45, DaveMoore wrote: ...
6 years, 1 month ago (2014-11-11 17:47:49 UTC) #5
jamesr
https://codereview.chromium.org/718473003/diff/40001/mojo/public/cpp/bindings/interface_impl.h File mojo/public/cpp/bindings/interface_impl.h (right): https://codereview.chromium.org/718473003/diff/40001/mojo/public/cpp/bindings/interface_impl.h#newcode29 mojo/public/cpp/bindings/interface_impl.h:29: void BindConnector( On 2014/11/11 17:47:49, jamesr wrote: > On ...
6 years, 1 month ago (2014-11-11 17:49:20 UTC) #6
jamesr
https://codereview.chromium.org/718473003/diff/40001/mojo/services/public/cpp/view_manager/lib/view_manager_client_factory.cc File mojo/services/public/cpp/view_manager/lib/view_manager_client_factory.cc (right): https://codereview.chromium.org/718473003/diff/40001/mojo/services/public/cpp/view_manager/lib/view_manager_client_factory.cc#newcode39 mojo/services/public/cpp/view_manager/lib/view_manager_client_factory.cc:39: impl->OnConnectionEstablished(); See https://codereview.chromium.org/713313002. The constructor initializes service_ (which is ...
6 years, 1 month ago (2014-11-11 18:06:05 UTC) #7
jamesr
The latest patch renames Connector->Binding and adds more information in the patch description about these ...
6 years, 1 month ago (2014-11-11 19:16:31 UTC) #8
DaveMoore
Now that I understand that the goal is to always use Binding<> this makes more ...
6 years, 1 month ago (2014-11-11 21:16:41 UTC) #9
jamesr
I think the error handling here needs more polish (i.e. you really want context on ...
6 years, 1 month ago (2014-11-12 00:02:21 UTC) #10
DaveMoore
lgtm https://codereview.chromium.org/718473003/diff/140001/mojo/public/cpp/bindings/interface_impl.h File mojo/public/cpp/bindings/interface_impl.h (right): https://codereview.chromium.org/718473003/diff/140001/mojo/public/cpp/bindings/interface_impl.h#newcode17 mojo/public/cpp/bindings/interface_impl.h:17: // BindToProxy. Nit: add comment that this class ...
6 years, 1 month ago (2014-11-13 00:00:36 UTC) #11
jamesr
Committed patchset #8 (id:140001) manually as 43fd6836c314a82308f2d158a1ddc6588d6005bc (presubmit successful).
6 years, 1 month ago (2014-11-13 00:24:33 UTC) #12
jamesr
6 years, 1 month ago (2014-11-13 01:44:56 UTC) #13
Message was sent while issue was closed.
https://codereview.chromium.org/718473003/diff/140001/mojo/public/cpp/binding...
File mojo/public/cpp/bindings/lib/interface_impl_internal.h (left):

https://codereview.chromium.org/718473003/diff/140001/mojo/public/cpp/binding...
mojo/public/cpp/bindings/lib/interface_impl_internal.h:100: // If the the
instance is not bound to the pipe, the instance might choose
whoops! this section of logic was pretty important.

restored in https://codereview.chromium.org/724563003/

Powered by Google App Engine
This is Rietveld 408576698