| OLD | NEW |
| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 ~BindingState() { Close(); } | 210 ~BindingState() { Close(); } |
| 211 | 211 |
| 212 void Bind(ScopedMessagePipeHandle handle, | 212 void Bind(ScopedMessagePipeHandle handle, |
| 213 scoped_refptr<base::SingleThreadTaskRunner> runner) { | 213 scoped_refptr<base::SingleThreadTaskRunner> runner) { |
| 214 MultiplexedBindingState::BindInternal( | 214 MultiplexedBindingState::BindInternal( |
| 215 std::move(handle), runner, Interface::Name_, | 215 std::move(handle), runner, Interface::Name_, |
| 216 base::MakeUnique<typename Interface::RequestValidator_>(), | 216 base::MakeUnique<typename Interface::RequestValidator_>(), |
| 217 Interface::PassesAssociatedKinds_, Interface::HasSyncMethods_, &stub_, | 217 Interface::PassesAssociatedKinds_, Interface::HasSyncMethods_, &stub_, |
| 218 Interface::Version_); | 218 Interface::Version_); |
| 219 stub_.serialization_context()->group_controller = router_; | 219 if (Interface::PassesAssociatedKinds_) |
| 220 stub_.serialization_context()->group_controller = router_; |
| 220 } | 221 } |
| 221 | 222 |
| 222 InterfaceRequest<Interface> Unbind() { | 223 InterfaceRequest<Interface> Unbind() { |
| 223 endpoint_client_.reset(); | 224 endpoint_client_.reset(); |
| 224 InterfaceRequest<Interface> request = | 225 InterfaceRequest<Interface> request = |
| 225 MakeRequest<Interface>(router_->PassMessagePipe()); | 226 MakeRequest<Interface>(router_->PassMessagePipe()); |
| 226 router_ = nullptr; | 227 router_ = nullptr; |
| 227 return request; | 228 return request; |
| 228 } | 229 } |
| 229 | 230 |
| 230 Interface* impl() { return ImplRefTraits::GetRawPointer(&stub_.sink()); } | 231 Interface* impl() { return ImplRefTraits::GetRawPointer(&stub_.sink()); } |
| 231 | 232 |
| 232 private: | 233 private: |
| 233 typename Interface::template Stub_<ImplRefTraits> stub_; | 234 typename Interface::template Stub_<ImplRefTraits> stub_; |
| 234 | 235 |
| 235 DISALLOW_COPY_AND_ASSIGN(BindingState); | 236 DISALLOW_COPY_AND_ASSIGN(BindingState); |
| 236 }; | 237 }; |
| 237 | 238 |
| 238 } // namesapce internal | 239 } // namesapce internal |
| 239 } // namespace mojo | 240 } // namespace mojo |
| 240 | 241 |
| 241 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ | 242 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ |
| OLD | NEW |