| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_INTERFACE_PTR_STATE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 router_ = new MultiplexRouter(std::move(handle_), config, true, runner_); | 191 router_ = new MultiplexRouter(std::move(handle_), config, true, runner_); |
| 192 router_->SetMasterInterfaceName(Interface::Name_); | 192 router_->SetMasterInterfaceName(Interface::Name_); |
| 193 endpoint_client_.reset(new InterfaceEndpointClient( | 193 endpoint_client_.reset(new InterfaceEndpointClient( |
| 194 router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr, | 194 router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr, |
| 195 base::WrapUnique(new typename Interface::ResponseValidator_()), false, | 195 base::WrapUnique(new typename Interface::ResponseValidator_()), false, |
| 196 std::move(runner_), | 196 std::move(runner_), |
| 197 // The version is only queried from the client so the value passed here | 197 // The version is only queried from the client so the value passed here |
| 198 // will not be used. | 198 // will not be used. |
| 199 0u)); | 199 0u)); |
| 200 proxy_.reset(new Proxy(endpoint_client_.get())); | 200 proxy_.reset(new Proxy(endpoint_client_.get())); |
| 201 if (Interface::PassesAssociatedKinds_) | |
| 202 proxy_->set_group_controller(endpoint_client_->group_controller()); | |
| 203 } | 201 } |
| 204 | 202 |
| 205 void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, | 203 void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, |
| 206 uint32_t version) { | 204 uint32_t version) { |
| 207 version_ = version; | 205 version_ = version; |
| 208 callback.Run(version); | 206 callback.Run(version); |
| 209 } | 207 } |
| 210 | 208 |
| 211 scoped_refptr<MultiplexRouter> router_; | 209 scoped_refptr<MultiplexRouter> router_; |
| 212 | 210 |
| 213 std::unique_ptr<InterfaceEndpointClient> endpoint_client_; | 211 std::unique_ptr<InterfaceEndpointClient> endpoint_client_; |
| 214 std::unique_ptr<Proxy> proxy_; | 212 std::unique_ptr<Proxy> proxy_; |
| 215 | 213 |
| 216 // |router_| (as well as other members above) is not initialized until | 214 // |router_| (as well as other members above) is not initialized until |
| 217 // read/write with the message pipe handle is needed. |handle_| is valid | 215 // read/write with the message pipe handle is needed. |handle_| is valid |
| 218 // between the Bind() call and the initialization of |router_|. | 216 // between the Bind() call and the initialization of |router_|. |
| 219 ScopedMessagePipeHandle handle_; | 217 ScopedMessagePipeHandle handle_; |
| 220 scoped_refptr<base::SingleThreadTaskRunner> runner_; | 218 scoped_refptr<base::SingleThreadTaskRunner> runner_; |
| 221 | 219 |
| 222 uint32_t version_; | 220 uint32_t version_; |
| 223 | 221 |
| 224 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); | 222 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); |
| 225 }; | 223 }; |
| 226 | 224 |
| 227 } // namespace internal | 225 } // namespace internal |
| 228 } // namespace mojo | 226 } // namespace mojo |
| 229 | 227 |
| 230 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ | 228 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ |
| OLD | NEW |