New issue
Advanced search Search tips

Issue 647312 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Support conversion between content and blink variants of InterfaceRequests

Project Member Reported by roc...@chromium.org, Sep 15 2016

Issue description

This would make it easier to pass strongly typed pipes across the blink/content boundary. Same applies to AssociatedInterfaceRequest/PtrInfo.
 

Comment 1 by yzshen@chromium.org, Sep 15 2016

Currently the template argument are different:
  InterfaceRequest<mojom::FooInterface>
  InterfaceRequest<mojom::blink::FooInterface>

We would have to make it something like:
InterfaceRequest<mojom::FooInterfaceBase> (or InterfaceRequest<mojom::GenericFooInterface>)

We could hide this base type with:
using FooRequest = InterfaceRequest<mojom::FooInterfaceBase>

But I am not quite sure whether the gain justify the confusion it may cause.

Maybe we could have a conversion helper:

template <class U, class V>
InterfaceRequest<U> Convert(InterfaceRequest<V>);  // a static member of InterfaceRequest

We can check that U and V are both derived classes of the some InterfaceBase, so it is still safe.
WDYT? Thanks!

Comment 2 by yzshen@chromium.org, Sep 15 2016

Oh, maybe it is more convenient to add constructor/assignment operator for the conversion, instead of using a static Convert() function.

Comment 3 by roc...@chromium.org, Sep 15 2016

Yeah I was assuming that aliasing to FooInterfaceBase would be an acceptable solution.

It's more complicated than I thought though, because A) there are lots of explicit references to mojo::InterfaceRequest<SomeType> already and those would have to change  B) there are legitimate reasons for developers to want to refer to mojo::InterfaceRequest<T>. We could do some particularly evil things to allow this to work seamlessly, but let's not.

I like your idea of a move ctor+operator that enforces U::Base==V::Base

Comment 4 by roc...@chromium.org, Sep 15 2016

Summary: Converting between InterfaceRequests (et al) of variants is painful (was: Variants can share InterfaceRequest/PtrInfo type aliases)
I need a solution that would not require including both variants in the same file.
Project Member

Comment 6 by sheriffbot@chromium.org, Sep 18 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -roc...@chromium.org rockot@google.com
Cc: -yzshen@chromium.org
Components: Internals>Mojo>Bindings
Labels: -Hotlist-Recharge-Cold
Labels: -Type-Bug Type-Feature
Status: Available (was: Untriaged)
Summary: Support conversion between content and blink variants of InterfaceRequests (was: Converting between InterfaceRequests (et al) of variants is painful)
We should add a generic interface placeholder type to mojom shared headers.

Sign in to add a comment