| 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()|. |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/sequenced_task_runner.h" |
| 21 #include "mojo/public/cpp/bindings/associated_group.h" | 21 #include "mojo/public/cpp/bindings/associated_group.h" |
| 22 #include "mojo/public/cpp/bindings/associated_group_controller.h" | 22 #include "mojo/public/cpp/bindings/associated_group_controller.h" |
| 23 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 23 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
| 24 #include "mojo/public/cpp/bindings/connection_error_callback.h" | 24 #include "mojo/public/cpp/bindings/connection_error_callback.h" |
| 25 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" | 25 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" |
| 26 #include "mojo/public/cpp/bindings/interface_id.h" | 26 #include "mojo/public/cpp/bindings/interface_id.h" |
| 27 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" | 27 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| 28 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" | 28 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
| 29 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" | 29 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
| 30 #include "mojo/public/cpp/system/message_pipe.h" | 30 #include "mojo/public/cpp/system/message_pipe.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 void Swap(AssociatedInterfacePtrState* other) { | 81 void Swap(AssociatedInterfacePtrState* other) { |
| 82 using std::swap; | 82 using std::swap; |
| 83 swap(other->endpoint_client_, endpoint_client_); | 83 swap(other->endpoint_client_, endpoint_client_); |
| 84 swap(other->proxy_, proxy_); | 84 swap(other->proxy_, proxy_); |
| 85 swap(other->version_, version_); | 85 swap(other->version_, version_); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void Bind(AssociatedInterfacePtrInfo<Interface> info, | 88 void Bind(AssociatedInterfacePtrInfo<Interface> info, |
| 89 scoped_refptr<base::SingleThreadTaskRunner> runner) { | 89 scoped_refptr<base::SequencedTaskRunner> runner) { |
| 90 DCHECK(!endpoint_client_); | 90 DCHECK(!endpoint_client_); |
| 91 DCHECK(!proxy_); | 91 DCHECK(!proxy_); |
| 92 DCHECK_EQ(0u, version_); | 92 DCHECK_EQ(0u, version_); |
| 93 DCHECK(info.is_valid()); | 93 DCHECK(info.is_valid()); |
| 94 | 94 |
| 95 version_ = info.version(); | 95 version_ = info.version(); |
| 96 // The version is only queried from the client so the value passed here | 96 // The version is only queried from the client so the value passed here |
| 97 // will not be used. | 97 // will not be used. |
| 98 endpoint_client_.reset(new InterfaceEndpointClient( | 98 endpoint_client_.reset(new InterfaceEndpointClient( |
| 99 info.PassHandle(), nullptr, | 99 info.PassHandle(), nullptr, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 uint32_t version_; | 162 uint32_t version_; |
| 163 | 163 |
| 164 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); | 164 DISALLOW_COPY_AND_ASSIGN(AssociatedInterfacePtrState); |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 } // namespace internal | 167 } // namespace internal |
| 168 } // namespace mojo | 168 } // namespace mojo |
| 169 | 169 |
| 170 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ | 170 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ASSOCIATED_INTERFACE_PTR_STATE_H_ |
| OLD | NEW |