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

Side by Side Diff: mojo/public/cpp/bindings/lib/binding_state.h

Issue 1475813002: Mojo C++ bindings: support passing associated interface pointers/requests in method parameter lists… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@25_use_multiplex_router
Patch Set: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_LIB_BINDING_STATE_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 ~BindingState() { 133 ~BindingState() {
134 if (router_) 134 if (router_)
135 Close(); 135 Close();
136 } 136 }
137 137
138 void Bind(ScopedMessagePipeHandle handle, const MojoAsyncWaiter* waiter) { 138 void Bind(ScopedMessagePipeHandle handle, const MojoAsyncWaiter* waiter) {
139 DCHECK(!router_); 139 DCHECK(!router_);
140 140
141 router_ = new internal::MultiplexRouter(false, handle.Pass(), waiter); 141 router_ = new internal::MultiplexRouter(false, handle.Pass(), waiter);
142 stub_.serialization_context()->router = router_;
143
142 endpoint_client_.reset(new internal::InterfaceEndpointClient( 144 endpoint_client_.reset(new internal::InterfaceEndpointClient(
143 router_->CreateLocalEndpointHandle(internal::kMasterInterfaceId), 145 router_->CreateLocalEndpointHandle(internal::kMasterInterfaceId),
144 &stub_, make_scoped_ptr(new typename Interface::RequestValidator_()))); 146 &stub_, make_scoped_ptr(new typename Interface::RequestValidator_())));
145 147
146 endpoint_client_->set_connection_error_handler( 148 endpoint_client_->set_connection_error_handler(
147 [this]() { connection_error_handler_.Run(); }); 149 [this]() { connection_error_handler_.Run(); });
148 } 150 }
149 151
150 void Close() { 152 void Close() {
151 DCHECK(router_); 153 DCHECK(router_);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 Interface* impl_; 199 Interface* impl_;
198 Closure connection_error_handler_; 200 Closure connection_error_handler_;
199 201
200 DISALLOW_COPY_AND_ASSIGN(BindingState); 202 DISALLOW_COPY_AND_ASSIGN(BindingState);
201 }; 203 };
202 204
203 } // namesapce internal 205 } // namesapce internal
204 } // namespace mojo 206 } // namespace mojo
205 207
206 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ 208 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h ('k') | mojo/public/cpp/bindings/lib/bindings_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698