| 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 <algorithm> // For |std::swap()|. | 8 #include <algorithm> // For |std::swap()|. |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // The object hasn't been bound. | 313 // The object hasn't been bound. |
| 314 if (!waiter_) { | 314 if (!waiter_) { |
| 315 DCHECK(!handle_.is_valid()); | 315 DCHECK(!handle_.is_valid()); |
| 316 return; | 316 return; |
| 317 } | 317 } |
| 318 | 318 |
| 319 router_ = new MultiplexRouter(true, handle_.Pass(), waiter_); | 319 router_ = new MultiplexRouter(true, handle_.Pass(), waiter_); |
| 320 endpoint_client_.reset(new InterfaceEndpointClient( | 320 endpoint_client_.reset(new InterfaceEndpointClient( |
| 321 router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr, | 321 router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr, |
| 322 make_scoped_ptr(new typename Interface::ResponseValidator_()))); | 322 make_scoped_ptr(new typename Interface::ResponseValidator_()))); |
| 323 proxy_.reset(new Proxy(endpoint_client_.get(), endpoint_client_->router())); | 323 proxy_.reset(new Proxy(endpoint_client_.get())); |
| 324 proxy_->serialization_context()->router = endpoint_client_->router(); |
| 324 | 325 |
| 325 waiter_ = nullptr; | 326 waiter_ = nullptr; |
| 326 } | 327 } |
| 327 | 328 |
| 328 scoped_refptr<MultiplexRouter> router_; | 329 scoped_refptr<MultiplexRouter> router_; |
| 329 | 330 |
| 330 scoped_ptr<InterfaceEndpointClient> endpoint_client_; | 331 scoped_ptr<InterfaceEndpointClient> endpoint_client_; |
| 331 scoped_ptr<Proxy> proxy_; | 332 scoped_ptr<Proxy> proxy_; |
| 332 | 333 |
| 333 // |router_| (as well as other members above) is not initialized until | 334 // |router_| (as well as other members above) is not initialized until |
| 334 // read/write with the message pipe handle is needed. |handle_| and |waiter_| | 335 // read/write with the message pipe handle is needed. |handle_| and |waiter_| |
| 335 // are valid between the Bind() call and the initialization of |router_|. | 336 // are valid between the Bind() call and the initialization of |router_|. |
| 336 ScopedMessagePipeHandle handle_; | 337 ScopedMessagePipeHandle handle_; |
| 337 const MojoAsyncWaiter* waiter_; | 338 const MojoAsyncWaiter* waiter_; |
| 338 | 339 |
| 339 uint32_t version_; | 340 uint32_t version_; |
| 340 | 341 |
| 341 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); | 342 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); |
| 342 }; | 343 }; |
| 343 | 344 |
| 344 } // namespace internal | 345 } // namespace internal |
| 345 } // namespace mojo | 346 } // namespace mojo |
| 346 | 347 |
| 347 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ | 348 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ |
| OLD | NEW |