| 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 <algorithm> // For |std::swap()|. | 8 #include <algorithm> // For |std::swap()|. |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 DCHECK(!endpoint_client_); | 73 DCHECK(!endpoint_client_); |
| 74 DCHECK(!proxy_); | 74 DCHECK(!proxy_); |
| 75 DCHECK_EQ(0u, version_); | 75 DCHECK_EQ(0u, version_); |
| 76 DCHECK(info.is_valid()); | 76 DCHECK(info.is_valid()); |
| 77 | 77 |
| 78 version_ = info.version(); | 78 version_ = info.version(); |
| 79 endpoint_client_.reset(new InterfaceEndpointClient( | 79 endpoint_client_.reset(new InterfaceEndpointClient( |
| 80 AssociatedInterfacePtrInfoHelper::PassHandle(&info), nullptr, | 80 AssociatedInterfacePtrInfoHelper::PassHandle(&info), nullptr, |
| 81 make_scoped_ptr(new typename Interface::ResponseValidator_()))); | 81 make_scoped_ptr(new typename Interface::ResponseValidator_()))); |
| 82 proxy_.reset(new Proxy(endpoint_client_.get())); | 82 proxy_.reset(new Proxy(endpoint_client_.get())); |
| 83 proxy_->serialization_context()->router = endpoint_client_->router(); |
| 83 } | 84 } |
| 84 | 85 |
| 85 // After this method is called, the object is in an invalid state and | 86 // After this method is called, the object is in an invalid state and |
| 86 // shouldn't be reused. | 87 // shouldn't be reused. |
| 87 AssociatedInterfacePtrInfo<Interface> PassInterface() { | 88 AssociatedInterfacePtrInfo<Interface> PassInterface() { |
| 88 ScopedInterfaceEndpointHandle handle = endpoint_client_->PassHandle(); | 89 ScopedInterfaceEndpointHandle handle = endpoint_client_->PassHandle(); |
| 89 endpoint_client_.reset(); | 90 endpoint_client_.reset(); |
| 90 proxy_.reset(); | 91 proxy_.reset(); |
| 91 | 92 |
| 92 AssociatedInterfacePtrInfo<Interface> result; | 93 AssociatedInterfacePtrInfo<Interface> result; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 123 | 124 |
| 124 uint32_t version_; | 125 uint32_t version_; |
| 125 | 126 |
| 126 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); | 127 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 } // namespace internal | 130 } // namespace internal |
| 130 } // namespace mojo | 131 } // namespace mojo |
| 131 | 132 |
| 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ | 133 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ |
| OLD | NEW |