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 | |
10 #include <algorithm> // For |std::swap()|. | 9 #include <algorithm> // For |std::swap()|. |
| 10 #include <utility> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "mojo/public/cpp/bindings/associated_group.h" | 14 #include "mojo/public/cpp/bindings/associated_group.h" |
15 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 15 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
16 #include "mojo/public/cpp/bindings/callback.h" | 16 #include "mojo/public/cpp/bindings/callback.h" |
17 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" | 17 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
18 #include "mojo/public/cpp/bindings/lib/interface_endpoint_client.h" | 18 #include "mojo/public/cpp/bindings/lib/interface_endpoint_client.h" |
19 #include "mojo/public/cpp/bindings/lib/interface_id.h" | 19 #include "mojo/public/cpp/bindings/lib/interface_id.h" |
20 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" | 20 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // After this method is called, the object is in an invalid state and | 90 // After this method is called, the object is in an invalid state and |
91 // shouldn't be reused. | 91 // shouldn't be reused. |
92 AssociatedInterfacePtrInfo<GenericInterface> PassInterface() { | 92 AssociatedInterfacePtrInfo<GenericInterface> PassInterface() { |
93 ScopedInterfaceEndpointHandle handle = endpoint_client_->PassHandle(); | 93 ScopedInterfaceEndpointHandle handle = endpoint_client_->PassHandle(); |
94 endpoint_client_.reset(); | 94 endpoint_client_.reset(); |
95 proxy_.reset(); | 95 proxy_.reset(); |
96 | 96 |
97 AssociatedInterfacePtrInfo<GenericInterface> result; | 97 AssociatedInterfacePtrInfo<GenericInterface> result; |
98 result.set_version(version_); | 98 result.set_version(version_); |
99 AssociatedInterfacePtrInfoHelper::SetHandle(&result, handle.Pass()); | 99 AssociatedInterfacePtrInfoHelper::SetHandle(&result, std::move(handle)); |
100 return result.Pass(); | 100 return result.Pass(); |
101 } | 101 } |
102 | 102 |
103 bool is_bound() const { return !!endpoint_client_; } | 103 bool is_bound() const { return !!endpoint_client_; } |
104 | 104 |
105 bool encountered_error() const { | 105 bool encountered_error() const { |
106 return endpoint_client_ ? endpoint_client_->encountered_error() : false; | 106 return endpoint_client_ ? endpoint_client_->encountered_error() : false; |
107 } | 107 } |
108 | 108 |
109 void set_connection_error_handler(const Closure& error_handler) { | 109 void set_connection_error_handler(const Closure& error_handler) { |
(...skipping 18 matching lines...) Expand all Loading... |
128 | 128 |
129 uint32_t version_; | 129 uint32_t version_; |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); | 131 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); |
132 }; | 132 }; |
133 | 133 |
134 } // namespace internal | 134 } // namespace internal |
135 } // namespace mojo | 135 } // namespace mojo |
136 | 136 |
137 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ | 137 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ |
OLD | NEW |