PSA: Mojo C++ interface bindings changes

37 views
Skip to first unread message

Vardhan Mudunuru

unread,
Feb 11, 2016, 6:07:35 PM2/11/16
to mojo...@chromium.org
Hi,

As per https://github.com/domokit/mojo/issues/662 (and a previous email thread on mojo-dev@), I pushed a change that generates interfaces bindings that work ontop of InterfaceHandle<> (formerly InterfacePtrInfo<>) instead of InterfacePtr<>.

This now means that service implementors will need to create an InterfacePtr<> explicitly from InterfaceHandle<>.  Example:

interface A {
  MethodA();
}

interface B {
  MethodB(A a);
}

C++ service implementation from before this change:

class BImpl : public B {
  ...
  // APtr is a typedef for "InterfacePtr<A>"
  MyMethodB(APtr a) { a->MethodA(); }
}

C++ service implementation after this change:

class BImpl : public B {
  // ...
  MyMethodB(InterfaceHandle<A> a) {
    auto a_ptr = APtr::Create(std::move(a));
    a_ptr->MethodA();
  }
}
Reply all
Reply to author
Forward
0 new messages