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

Unified Diff: mojo/public/cpp/bindings/lib/interface_ptr_state.h

Issue 1524693002: [mojo] Add GenericInterface_ to interface class variants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bindings-2-typemaps
Patch Set: merge Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/lib/interface_ptr_state.h
diff --git a/mojo/public/cpp/bindings/lib/interface_ptr_state.h b/mojo/public/cpp/bindings/lib/interface_ptr_state.h
index 8b8d6706fd47560848d3da0be0715c7cf886e389..d203031819b2a96fd6ce6724529d78b8788e4ce3 100644
--- a/mojo/public/cpp/bindings/lib/interface_ptr_state.h
+++ b/mojo/public/cpp/bindings/lib/interface_ptr_state.h
@@ -38,6 +38,8 @@ class InterfacePtrState;
template <typename Interface>
class InterfacePtrState<Interface, false> {
public:
+ using GenericInterface = typename Interface::GenericInterface;
+
InterfacePtrState()
: proxy_(nullptr), router_(nullptr), waiter_(nullptr), version_(0u) {}
@@ -94,7 +96,8 @@ class InterfacePtrState<Interface, false> {
swap(other->version_, version_);
}
- void Bind(InterfacePtrInfo<Interface> info, const MojoAsyncWaiter* waiter) {
+ void Bind(InterfacePtrInfo<GenericInterface> info,
+ const MojoAsyncWaiter* waiter) {
DCHECK(!proxy_);
DCHECK(!router_);
DCHECK(!handle_.is_valid());
@@ -118,8 +121,8 @@ class InterfacePtrState<Interface, false> {
// After this method is called, the object is in an invalid state and
// shouldn't be reused.
- InterfacePtrInfo<Interface> PassInterface() {
- return InterfacePtrInfo<Interface>(
+ InterfacePtrInfo<GenericInterface> PassInterface() {
+ return InterfacePtrInfo<GenericInterface>(
router_ ? router_->PassMessagePipe() : handle_.Pass(), version_);
}
@@ -192,6 +195,8 @@ class InterfacePtrState<Interface, false> {
template <typename Interface>
class InterfacePtrState<Interface, true> {
public:
+ using GenericInterface = typename Interface::GenericInterface;
+
InterfacePtrState() : waiter_(nullptr), version_(0u) {}
~InterfacePtrState() {
@@ -248,7 +253,8 @@ class InterfacePtrState<Interface, true> {
swap(other->version_, version_);
}
- void Bind(InterfacePtrInfo<Interface> info, const MojoAsyncWaiter* waiter) {
+ void Bind(InterfacePtrInfo<GenericInterface> info,
+ const MojoAsyncWaiter* waiter) {
DCHECK(!router_);
DCHECK(!endpoint_client_);
DCHECK(!proxy_);
@@ -275,10 +281,10 @@ class InterfacePtrState<Interface, true> {
// After this method is called, the object is in an invalid state and
// shouldn't be reused.
- InterfacePtrInfo<Interface> PassInterface() {
+ InterfacePtrInfo<GenericInterface> PassInterface() {
endpoint_client_.reset();
proxy_.reset();
- return InterfacePtrInfo<Interface>(
+ return InterfacePtrInfo<GenericInterface>(
router_ ? router_->PassMessagePipe() : handle_.Pass(), version_);
}

Powered by Google App Engine
This is Rietveld 408576698