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

Side by Side Diff: mojo/public/cpp/bindings/interface_request.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
7 7
8 #include "mojo/public/cpp/bindings/interface_ptr.h" 8 #include "mojo/public/cpp/bindings/interface_ptr.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // 100 //
101 // The client would have code similar to the following: 101 // The client would have code similar to the following:
102 // 102 //
103 // CollectorPtr collector = ...; // Connect to Collector. 103 // CollectorPtr collector = ...; // Connect to Collector.
104 // SourcePtr source; 104 // SourcePtr source;
105 // InterfaceRequest<Source> source_request = GetProxy(&source); 105 // InterfaceRequest<Source> source_request = GetProxy(&source);
106 // collector->RegisterSource(source.Pass()); 106 // collector->RegisterSource(source.Pass());
107 // CreateSource(source_request.Pass()); // Create implementation locally. 107 // CreateSource(source_request.Pass()); // Create implementation locally.
108 // 108 //
109 template <typename Interface> 109 template <typename Interface>
110 InterfaceRequest<Interface> GetProxy(InterfacePtr<Interface>* ptr) { 110 InterfaceRequest<typename Interface::GenericInterface>
111 GetProxy(InterfacePtr<Interface>* ptr) {
111 MessagePipe pipe; 112 MessagePipe pipe;
112 ptr->Bind(InterfacePtrInfo<Interface>(pipe.handle0.Pass(), 0u)); 113 ptr->Bind(InterfacePtrInfo<typename Interface::GenericInterface>(
113 return MakeRequest<Interface>(pipe.handle1.Pass()); 114 pipe.handle0.Pass(), 0u));
115 return MakeRequest<typename Interface::GenericInterface>(
116 pipe.handle1.Pass());
114 } 117 }
115 118
116 } // namespace mojo 119 } // namespace mojo
117 120
118 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ 121 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698