| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 ~BindingState() { Close(); } | 103 ~BindingState() { Close(); } |
| 104 | 104 |
| 105 void Bind(ScopedMessagePipeHandle handle, | 105 void Bind(ScopedMessagePipeHandle handle, |
| 106 scoped_refptr<base::SingleThreadTaskRunner> runner) { | 106 scoped_refptr<base::SingleThreadTaskRunner> runner) { |
| 107 BindingStateBase::BindInternal( | 107 BindingStateBase::BindInternal( |
| 108 std::move(handle), runner, Interface::Name_, | 108 std::move(handle), runner, Interface::Name_, |
| 109 base::MakeUnique<typename Interface::RequestValidator_>(), | 109 base::MakeUnique<typename Interface::RequestValidator_>(), |
| 110 Interface::PassesAssociatedKinds_, Interface::HasSyncMethods_, &stub_, | 110 Interface::PassesAssociatedKinds_, Interface::HasSyncMethods_, &stub_, |
| 111 Interface::Version_); | 111 Interface::Version_); |
| 112 if (Interface::PassesAssociatedKinds_) | |
| 113 stub_.serialization_context()->group_controller = router_; | |
| 114 } | 112 } |
| 115 | 113 |
| 116 InterfaceRequest<Interface> Unbind() { | 114 InterfaceRequest<Interface> Unbind() { |
| 117 endpoint_client_.reset(); | 115 endpoint_client_.reset(); |
| 118 InterfaceRequest<Interface> request = | 116 InterfaceRequest<Interface> request = |
| 119 MakeRequest<Interface>(router_->PassMessagePipe()); | 117 MakeRequest<Interface>(router_->PassMessagePipe()); |
| 120 router_ = nullptr; | 118 router_ = nullptr; |
| 121 return request; | 119 return request; |
| 122 } | 120 } |
| 123 | 121 |
| 124 Interface* impl() { return ImplRefTraits::GetRawPointer(&stub_.sink()); } | 122 Interface* impl() { return ImplRefTraits::GetRawPointer(&stub_.sink()); } |
| 125 | 123 |
| 126 private: | 124 private: |
| 127 typename Interface::template Stub_<ImplRefTraits> stub_; | 125 typename Interface::template Stub_<ImplRefTraits> stub_; |
| 128 | 126 |
| 129 DISALLOW_COPY_AND_ASSIGN(BindingState); | 127 DISALLOW_COPY_AND_ASSIGN(BindingState); |
| 130 }; | 128 }; |
| 131 | 129 |
| 132 } // namesapce internal | 130 } // namesapce internal |
| 133 } // namespace mojo | 131 } // namespace mojo |
| 134 | 132 |
| 135 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ | 133 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ |
| OLD | NEW |