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 | 9 |
10 #include <algorithm> // For |std::swap()|. | 10 #include <algorithm> // For |std::swap()|. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 AssociatedGroup* associated_group() { | 126 AssociatedGroup* associated_group() { |
127 return endpoint_client_ ? endpoint_client_->associated_group() : nullptr; | 127 return endpoint_client_ ? endpoint_client_->associated_group() : nullptr; |
128 } | 128 } |
129 | 129 |
130 void ForwardMessage(Message message) { endpoint_client_->Accept(&message); } | 130 void ForwardMessage(Message message) { endpoint_client_->Accept(&message); } |
131 | 131 |
132 void ForwardMessageWithResponder(Message message, | 132 void ForwardMessageWithResponder(Message message, |
133 std::unique_ptr<MessageReceiver> responder) { | 133 std::unique_ptr<MessageReceiver> responder) { |
134 endpoint_client_->AcceptWithResponder(&message, responder.release()); | 134 endpoint_client_->AcceptWithResponder(&message, std::move(responder)); |
135 } | 135 } |
136 | 136 |
137 private: | 137 private: |
138 using Proxy = typename Interface::Proxy_; | 138 using Proxy = typename Interface::Proxy_; |
139 | 139 |
140 void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, | 140 void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, |
141 uint32_t version) { | 141 uint32_t version) { |
142 version_ = version; | 142 version_ = version; |
143 callback.Run(version); | 143 callback.Run(version); |
144 } | 144 } |
145 | 145 |
146 std::unique_ptr<InterfaceEndpointClient> endpoint_client_; | 146 std::unique_ptr<InterfaceEndpointClient> endpoint_client_; |
147 std::unique_ptr<Proxy> proxy_; | 147 std::unique_ptr<Proxy> proxy_; |
148 | 148 |
149 uint32_t version_; | 149 uint32_t version_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); | 151 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); |
152 }; | 152 }; |
153 | 153 |
154 } // namespace internal | 154 } // namespace internal |
155 } // namespace mojo | 155 } // namespace mojo |
156 | 156 |
157 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ | 157 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ |
OLD | NEW |