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/multiplex_router.h" | 5 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 next_interface_id_value_(1), | 296 next_interface_id_value_(1), |
297 posted_to_process_tasks_(false), | 297 posted_to_process_tasks_(false), |
298 encountered_error_(false), | 298 encountered_error_(false), |
299 testing_mode_(false) { | 299 testing_mode_(false) { |
300 // Always participate in sync handle watching, because even if it doesn't | 300 // Always participate in sync handle watching, because even if it doesn't |
301 // expect sync requests during sync handle watching, it may still need to | 301 // expect sync requests during sync handle watching, it may still need to |
302 // dispatch messages to associated endpoints on a different thread. | 302 // dispatch messages to associated endpoints on a different thread. |
303 connector_.AllowWokenUpBySyncWatchOnSameThread(); | 303 connector_.AllowWokenUpBySyncWatchOnSameThread(); |
304 connector_.set_incoming_receiver(&header_validator_); | 304 connector_.set_incoming_receiver(&header_validator_); |
305 connector_.set_connection_error_handler( | 305 connector_.set_connection_error_handler( |
306 [this]() { OnPipeConnectionError(); }); | 306 base::Bind(&MultiplexRouter::OnPipeConnectionError, |
| 307 base::Unretained(this))); |
307 } | 308 } |
308 | 309 |
309 MultiplexRouter::~MultiplexRouter() { | 310 MultiplexRouter::~MultiplexRouter() { |
310 base::AutoLock locker(lock_); | 311 base::AutoLock locker(lock_); |
311 | 312 |
312 sync_message_tasks_.clear(); | 313 sync_message_tasks_.clear(); |
313 tasks_.clear(); | 314 tasks_.clear(); |
314 | 315 |
315 for (auto iter = endpoints_.begin(); iter != endpoints_.end();) { | 316 for (auto iter = endpoints_.begin(); iter != endpoints_.end();) { |
316 InterfaceEndpoint* endpoint = iter->second.get(); | 317 InterfaceEndpoint* endpoint = iter->second.get(); |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 *inserted = true; | 851 *inserted = true; |
851 } else { | 852 } else { |
852 endpoint = iter->second.get(); | 853 endpoint = iter->second.get(); |
853 } | 854 } |
854 | 855 |
855 return endpoint; | 856 return endpoint; |
856 } | 857 } |
857 | 858 |
858 } // namespace internal | 859 } // namespace internal |
859 } // namespace mojo | 860 } // namespace mojo |
OLD | NEW |