| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 router_ = new MultiplexRouter(std::move(handle_), config, true, runner_); | 354 router_ = new MultiplexRouter(std::move(handle_), config, true, runner_); |
| 355 router_->SetMasterInterfaceName(Interface::Name_); | 355 router_->SetMasterInterfaceName(Interface::Name_); |
| 356 endpoint_client_.reset(new InterfaceEndpointClient( | 356 endpoint_client_.reset(new InterfaceEndpointClient( |
| 357 router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr, | 357 router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr, |
| 358 base::WrapUnique(new typename Interface::ResponseValidator_()), false, | 358 base::WrapUnique(new typename Interface::ResponseValidator_()), false, |
| 359 std::move(runner_), | 359 std::move(runner_), |
| 360 // The version is only queried from the client so the value passed here | 360 // The version is only queried from the client so the value passed here |
| 361 // will not be used. | 361 // will not be used. |
| 362 0u)); | 362 0u)); |
| 363 proxy_.reset(new Proxy(endpoint_client_.get())); | 363 proxy_.reset(new Proxy(endpoint_client_.get())); |
| 364 proxy_->serialization_context()->group_controller = | 364 if (Interface::PassesAssociatedKinds_) { |
| 365 endpoint_client_->group_controller(); | 365 proxy_->serialization_context()->group_controller = |
| 366 endpoint_client_->group_controller(); |
| 367 } |
| 366 } | 368 } |
| 367 | 369 |
| 368 void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, | 370 void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, |
| 369 uint32_t version) { | 371 uint32_t version) { |
| 370 version_ = version; | 372 version_ = version; |
| 371 callback.Run(version); | 373 callback.Run(version); |
| 372 } | 374 } |
| 373 | 375 |
| 374 scoped_refptr<MultiplexRouter> router_; | 376 scoped_refptr<MultiplexRouter> router_; |
| 375 | 377 |
| 376 std::unique_ptr<InterfaceEndpointClient> endpoint_client_; | 378 std::unique_ptr<InterfaceEndpointClient> endpoint_client_; |
| 377 std::unique_ptr<Proxy> proxy_; | 379 std::unique_ptr<Proxy> proxy_; |
| 378 | 380 |
| 379 // |router_| (as well as other members above) is not initialized until | 381 // |router_| (as well as other members above) is not initialized until |
| 380 // read/write with the message pipe handle is needed. |handle_| is valid | 382 // read/write with the message pipe handle is needed. |handle_| is valid |
| 381 // between the Bind() call and the initialization of |router_|. | 383 // between the Bind() call and the initialization of |router_|. |
| 382 ScopedMessagePipeHandle handle_; | 384 ScopedMessagePipeHandle handle_; |
| 383 scoped_refptr<base::SingleThreadTaskRunner> runner_; | 385 scoped_refptr<base::SingleThreadTaskRunner> runner_; |
| 384 | 386 |
| 385 uint32_t version_; | 387 uint32_t version_; |
| 386 | 388 |
| 387 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); | 389 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); |
| 388 }; | 390 }; |
| 389 | 391 |
| 390 } // namespace internal | 392 } // namespace internal |
| 391 } // namespace mojo | 393 } // namespace mojo |
| 392 | 394 |
| 393 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ | 395 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ |
| OLD | NEW |