| 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_ASSOCIATED_INTERFACE_PTR_STATE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <algorithm> // For |std::swap()|. | 9 #include <algorithm> // For |std::swap()|. |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 void Bind(AssociatedInterfacePtrInfo<Interface> info) { | 80 void Bind(AssociatedInterfacePtrInfo<Interface> info) { |
| 81 DCHECK(!endpoint_client_); | 81 DCHECK(!endpoint_client_); |
| 82 DCHECK(!proxy_); | 82 DCHECK(!proxy_); |
| 83 DCHECK_EQ(0u, version_); | 83 DCHECK_EQ(0u, version_); |
| 84 DCHECK(info.is_valid()); | 84 DCHECK(info.is_valid()); |
| 85 | 85 |
| 86 version_ = info.version(); | 86 version_ = info.version(); |
| 87 endpoint_client_.reset(new InterfaceEndpointClient( | 87 endpoint_client_.reset(new InterfaceEndpointClient( |
| 88 AssociatedInterfacePtrInfoHelper::PassHandle(&info), nullptr, | 88 AssociatedInterfacePtrInfoHelper::PassHandle(&info), nullptr, |
| 89 make_scoped_ptr(new typename Interface::ResponseValidator_()))); | 89 make_scoped_ptr(new typename Interface::ResponseValidator_()), false)); |
| 90 proxy_.reset(new Proxy(endpoint_client_.get())); | 90 proxy_.reset(new Proxy(endpoint_client_.get())); |
| 91 proxy_->serialization_context()->router = endpoint_client_->router(); | 91 proxy_->serialization_context()->router = endpoint_client_->router(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // After this method is called, the object is in an invalid state and | 94 // After this method is called, the object is in an invalid state and |
| 95 // shouldn't be reused. | 95 // shouldn't be reused. |
| 96 AssociatedInterfacePtrInfo<Interface> PassInterface() { | 96 AssociatedInterfacePtrInfo<Interface> PassInterface() { |
| 97 ScopedInterfaceEndpointHandle handle = endpoint_client_->PassHandle(); | 97 ScopedInterfaceEndpointHandle handle = endpoint_client_->PassHandle(); |
| 98 endpoint_client_.reset(); | 98 endpoint_client_.reset(); |
| 99 proxy_.reset(); | 99 proxy_.reset(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 uint32_t version_; | 133 uint32_t version_; |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); | 135 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace internal | 138 } // namespace internal |
| 139 } // namespace mojo | 139 } // namespace mojo |
| 140 | 140 |
| 141 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ | 141 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ |
| OLD | NEW |