| 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 #include "mojo/public/cpp/bindings/lib/interface_endpoint_client.h" | 5 #include "mojo/public/cpp/bindings/lib/interface_endpoint_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "mojo/public/cpp/bindings/associated_group.h" |
| 10 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" | 11 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" |
| 11 | 12 |
| 12 namespace mojo { | 13 namespace mojo { |
| 13 namespace internal { | 14 namespace internal { |
| 14 | 15 |
| 15 // ---------------------------------------------------------------------------- | 16 // ---------------------------------------------------------------------------- |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 // When receiving an incoming message which expects a repsonse, | 20 // When receiving an incoming message which expects a repsonse, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 111 } |
| 111 | 112 |
| 112 InterfaceEndpointClient::~InterfaceEndpointClient() { | 113 InterfaceEndpointClient::~InterfaceEndpointClient() { |
| 113 DCHECK(thread_checker_.CalledOnValidThread()); | 114 DCHECK(thread_checker_.CalledOnValidThread()); |
| 114 | 115 |
| 115 STLDeleteValues(&responders_); | 116 STLDeleteValues(&responders_); |
| 116 | 117 |
| 117 handle_.router()->DetachEndpointClient(handle_); | 118 handle_.router()->DetachEndpointClient(handle_); |
| 118 } | 119 } |
| 119 | 120 |
| 121 AssociatedGroup* InterfaceEndpointClient::associated_group() { |
| 122 if (!associated_group_) |
| 123 associated_group_ = handle_.router()->CreateAssociatedGroup(); |
| 124 return associated_group_.get(); |
| 125 } |
| 126 |
| 120 ScopedInterfaceEndpointHandle InterfaceEndpointClient::PassHandle() { | 127 ScopedInterfaceEndpointHandle InterfaceEndpointClient::PassHandle() { |
| 121 DCHECK(thread_checker_.CalledOnValidThread()); | 128 DCHECK(thread_checker_.CalledOnValidThread()); |
| 122 DCHECK(!has_pending_responders()); | 129 DCHECK(!has_pending_responders()); |
| 123 | 130 |
| 124 if (!handle_.is_valid()) | 131 if (!handle_.is_valid()) |
| 125 return ScopedInterfaceEndpointHandle(); | 132 return ScopedInterfaceEndpointHandle(); |
| 126 | 133 |
| 127 handle_.router()->DetachEndpointClient(handle_); | 134 handle_.router()->DetachEndpointClient(handle_); |
| 128 | 135 |
| 129 return handle_.Pass(); | 136 return handle_.Pass(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } else { | 216 } else { |
| 210 if (!incoming_receiver_) | 217 if (!incoming_receiver_) |
| 211 return false; | 218 return false; |
| 212 | 219 |
| 213 return incoming_receiver_->Accept(message); | 220 return incoming_receiver_->Accept(message); |
| 214 } | 221 } |
| 215 } | 222 } |
| 216 | 223 |
| 217 } // namespace internal | 224 } // namespace internal |
| 218 } // namespace mojo | 225 } // namespace mojo |
| OLD | NEW |