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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // because it may remove the corresponding value from the map. | 318 // because it may remove the corresponding value from the map. |
319 ++iter; | 319 ++iter; |
320 | 320 |
321 DCHECK(endpoint->closed()); | 321 DCHECK(endpoint->closed()); |
322 UpdateEndpointStateMayRemove(endpoint, PEER_ENDPOINT_CLOSED); | 322 UpdateEndpointStateMayRemove(endpoint, PEER_ENDPOINT_CLOSED); |
323 } | 323 } |
324 | 324 |
325 DCHECK(endpoints_.empty()); | 325 DCHECK(endpoints_.empty()); |
326 } | 326 } |
327 | 327 |
| 328 void MultiplexRouter::SetMasterInterfaceName(const std::string& name) { |
| 329 DCHECK(thread_checker_.CalledOnValidThread()); |
| 330 header_validator_.SetDescription(name + " [master] MessageHeaderValidator"); |
| 331 control_message_handler_.SetDescription( |
| 332 name + " [master] PipeControlMessageHandler"); |
| 333 } |
| 334 |
328 void MultiplexRouter::CreateEndpointHandlePair( | 335 void MultiplexRouter::CreateEndpointHandlePair( |
329 ScopedInterfaceEndpointHandle* local_endpoint, | 336 ScopedInterfaceEndpointHandle* local_endpoint, |
330 ScopedInterfaceEndpointHandle* remote_endpoint) { | 337 ScopedInterfaceEndpointHandle* remote_endpoint) { |
331 base::AutoLock locker(lock_); | 338 base::AutoLock locker(lock_); |
332 uint32_t id = 0; | 339 uint32_t id = 0; |
333 do { | 340 do { |
334 if (next_interface_id_value_ >= kInterfaceIdNamespaceMask) | 341 if (next_interface_id_value_ >= kInterfaceIdNamespaceMask) |
335 next_interface_id_value_ = 1; | 342 next_interface_id_value_ = 1; |
336 id = next_interface_id_value_++; | 343 id = next_interface_id_value_++; |
337 if (set_interface_id_namespace_bit_) | 344 if (set_interface_id_namespace_bit_) |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 *inserted = true; | 850 *inserted = true; |
844 } else { | 851 } else { |
845 endpoint = iter->second.get(); | 852 endpoint = iter->second.get(); |
846 } | 853 } |
847 | 854 |
848 return endpoint; | 855 return endpoint; |
849 } | 856 } |
850 | 857 |
851 } // namespace internal | 858 } // namespace internal |
852 } // namespace mojo | 859 } // namespace mojo |
OLD | NEW |