| 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_ASSOCIATED_BINDING_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "mojo/public/cpp/bindings/associated_group.h" | 10 #include "mojo/public/cpp/bindings/associated_group.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 << "other side of the message pipe."; | 72 << "other side of the message pipe."; |
| 73 | 73 |
| 74 if (!handle.is_valid() || !handle.is_local()) { | 74 if (!handle.is_valid() || !handle.is_local()) { |
| 75 endpoint_client_.reset(); | 75 endpoint_client_.reset(); |
| 76 return; | 76 return; |
| 77 } | 77 } |
| 78 | 78 |
| 79 endpoint_client_.reset(new internal::InterfaceEndpointClient( | 79 endpoint_client_.reset(new internal::InterfaceEndpointClient( |
| 80 handle.Pass(), &stub_, | 80 handle.Pass(), &stub_, |
| 81 make_scoped_ptr(new typename Interface::RequestValidator_()))); | 81 make_scoped_ptr(new typename Interface::RequestValidator_()))); |
| 82 | |
| 83 endpoint_client_->set_connection_error_handler( | 82 endpoint_client_->set_connection_error_handler( |
| 84 [this]() { connection_error_handler_.Run(); }); | 83 [this]() { connection_error_handler_.Run(); }); |
| 84 |
| 85 stub_.serialization_context()->router = endpoint_client_->router(); |
| 85 } | 86 } |
| 86 | 87 |
| 87 // Closes the associated interface. Puts this object into a state where it can | 88 // Closes the associated interface. Puts this object into a state where it can |
| 88 // be rebound. | 89 // be rebound. |
| 89 void Close() { | 90 void Close() { |
| 90 DCHECK(endpoint_client_); | 91 DCHECK(endpoint_client_); |
| 91 endpoint_client_.reset(); | 92 endpoint_client_.reset(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 // Unbinds and returns the associated interface request so it can be | 95 // Unbinds and returns the associated interface request so it can be |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 typename Interface::Stub_ stub_; | 130 typename Interface::Stub_ stub_; |
| 130 Interface* impl_; | 131 Interface* impl_; |
| 131 Closure connection_error_handler_; | 132 Closure connection_error_handler_; |
| 132 | 133 |
| 133 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding); | 134 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding); |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 } // namespace mojo | 137 } // namespace mojo |
| 137 | 138 |
| 138 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ | 139 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ |
| OLD | NEW |