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/interface_endpoint_client.h" | 5 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 controller_ = handle_.group_controller()->AttachEndpointClient( | 153 controller_ = handle_.group_controller()->AttachEndpointClient( |
154 handle_, this, task_runner_); | 154 handle_, this, task_runner_); |
155 if (expect_sync_requests) | 155 if (expect_sync_requests) |
156 controller_->AllowWokenUpBySyncWatchOnSameThread(); | 156 controller_->AllowWokenUpBySyncWatchOnSameThread(); |
157 } | 157 } |
158 | 158 |
159 InterfaceEndpointClient::~InterfaceEndpointClient() { | 159 InterfaceEndpointClient::~InterfaceEndpointClient() { |
160 DCHECK(thread_checker_.CalledOnValidThread()); | 160 DCHECK(thread_checker_.CalledOnValidThread()); |
161 | 161 |
162 handle_.group_controller()->DetachEndpointClient(handle_); | 162 if (handle_.is_valid()) |
| 163 handle_.group_controller()->DetachEndpointClient(handle_); |
163 } | 164 } |
164 | 165 |
165 AssociatedGroup* InterfaceEndpointClient::associated_group() { | 166 AssociatedGroup* InterfaceEndpointClient::associated_group() { |
166 if (!associated_group_) | 167 if (!associated_group_) |
167 associated_group_ = handle_.group_controller()->CreateAssociatedGroup(); | 168 associated_group_ = handle_.group_controller()->CreateAssociatedGroup(); |
168 return associated_group_.get(); | 169 return associated_group_.get(); |
169 } | 170 } |
170 | 171 |
171 uint32_t InterfaceEndpointClient::interface_id() const { | 172 uint32_t InterfaceEndpointClient::interface_id() const { |
172 DCHECK(thread_checker_.CalledOnValidThread()); | 173 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return responder->Accept(message); | 306 return responder->Accept(message); |
306 } else { | 307 } else { |
307 if (!incoming_receiver_) | 308 if (!incoming_receiver_) |
308 return false; | 309 return false; |
309 | 310 |
310 return incoming_receiver_->Accept(message); | 311 return incoming_receiver_->Accept(message); |
311 } | 312 } |
312 } | 313 } |
313 | 314 |
314 } // namespace mojo | 315 } // namespace mojo |
OLD | NEW |