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

Issue 686883005: Provides a way to use bindings that doesn't require subclassing (Closed)

Created:
6 years, 1 month ago by sky
Modified:
6 years, 1 month ago
Reviewers:
jamesr, DaveMoore
CC:
mojo-reviews_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, darin (slow to review), ben+mojo_chromium.org
Base URL:
https://github.com/domokit/mojo.git@master
Project:
mojo
Visibility:
Public.

Description

Provides a way to use bindings that doesn't require subclassing I'm writing a test and want to test a concrete implementation of my mojo service. My service has a client. I don't want to create a pipe or anything for my test; that all doesn't matter. Rather I want to directly create my concrete service class and supply a test client implementation. This has the added benefit of all being synchronous. Having my service implementation subclass InterfaceImpl is a bit awkward. It doesn't make sense for InterfaceImpl to allow setting the client and I get some baggage from the superclass. I split out the logic managing the binding into a class called InterfaceBinding. I changed InterfaceImpl to internally use this class. So, you can either subclass InterfaceImpl (as you always have) or use InterfaceBinding supplying your service implementation (that doesn't subclass InterfaceImpl). Having InterfaceImpl and InterfaceBinding share code results in some what tricky code. R=davemoore@chromium.org, jamesr@chromium.org

Patch Set 1 #

Patch Set 2 : comment #

Total comments: 7

Patch Set 3 : merge 2 trunk #

Patch Set 4 : review feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+184 lines, -54 lines) Patch
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/interface_binding.h View 1 2 3 1 chunk +109 lines, -0 lines 0 comments Download
A mojo/public/cpp/bindings/interface_binding_delegate.h View 1 1 chunk +24 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/interface_impl.h View 1 2 3 5 chunks +33 lines, -13 lines 0 comments Download
M mojo/public/cpp/bindings/lib/interface_impl_internal.h View 4 chunks +16 lines, -41 lines 0 comments Download

Messages

Total messages: 10 (2 generated)
sky
6 years, 1 month ago (2014-11-10 23:25:16 UTC) #1
jamesr
I wrote almost the same class independently on a plane this weekend so I definitely ...
6 years, 1 month ago (2014-11-10 23:35:22 UTC) #4
Aaron Boodman
I don't see the part that allows you to set the client...?
6 years, 1 month ago (2014-11-10 23:45:40 UTC) #5
DaveMoore
https://codereview.chromium.org/686883005/diff/20001/mojo/public/cpp/bindings/interface_impl.h File mojo/public/cpp/bindings/interface_impl.h (right): https://codereview.chromium.org/686883005/diff/20001/mojo/public/cpp/bindings/interface_impl.h#newcode30 mojo/public/cpp/bindings/interface_impl.h:30: // . InterfaceBinding can own the Nit: Extra line? ...
6 years, 1 month ago (2014-11-10 23:54:23 UTC) #6
sky
I've uploaded a new patch. I have one more TODO should we decide to go ...
6 years, 1 month ago (2014-11-11 00:34:57 UTC) #7
jamesr
https://codereview.chromium.org/718473003 is the thing I wrote up on the plane - it goes slightly further ...
6 years, 1 month ago (2014-11-11 00:37:27 UTC) #8
DaveMoore
https://codereview.chromium.org/686883005/diff/20001/mojo/public/cpp/bindings/interface_impl.h File mojo/public/cpp/bindings/interface_impl.h (right): https://codereview.chromium.org/686883005/diff/20001/mojo/public/cpp/bindings/interface_impl.h#newcode100 mojo/public/cpp/bindings/interface_impl.h:100: // while calling to delegate. On 2014/11/11 00:34:57, sky ...
6 years, 1 month ago (2014-11-11 16:04:15 UTC) #9
sky
6 years, 1 month ago (2014-11-11 18:35:45 UTC) #10
There doesn't seem to be a strong preference for this or James's. James seems
further along and his has some nice benefits, so I'm closing this out.

Powered by Google App Engine
This is Rietveld 408576698