OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ipc/ipc_channel_mojo.h" | 5 #include "ipc/ipc_channel_mojo.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 GenericAssociatedInterfaceFactory factory; | 342 GenericAssociatedInterfaceFactory factory; |
343 { | 343 { |
344 base::AutoLock locker(associated_interface_lock_); | 344 base::AutoLock locker(associated_interface_lock_); |
345 auto iter = associated_interfaces_.find(name); | 345 auto iter = associated_interfaces_.find(name); |
346 if (iter != associated_interfaces_.end()) | 346 if (iter != associated_interfaces_.end()) |
347 factory = iter->second; | 347 factory = iter->second; |
348 } | 348 } |
349 | 349 |
350 if (!factory.is_null()) | 350 if (!factory.is_null()) |
351 factory.Run(std::move(handle)); | 351 factory.Run(std::move(handle)); |
| 352 else |
| 353 listener_->OnAssociatedInterfaceRequest(name, std::move(handle)); |
352 } | 354 } |
353 | 355 |
354 bool ChannelMojo::Send(Message* message) { | 356 bool ChannelMojo::Send(Message* message) { |
355 std::unique_ptr<Message> scoped_message = base::WrapUnique(message); | 357 std::unique_ptr<Message> scoped_message = base::WrapUnique(message); |
356 if (!message_reader_) | 358 if (!message_reader_) |
357 return false; | 359 return false; |
358 | 360 |
359 // Comment copied from ipc_channel_posix.cc: | 361 // Comment copied from ipc_channel_posix.cc: |
360 // We can't close the pipe here, because calling OnChannelError may destroy | 362 // We can't close the pipe here, because calling OnChannelError may destroy |
361 // this object, and that would be bad if we are called from Send(). Instead, | 363 // this object, and that would be bad if we are called from Send(). Instead, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 } | 497 } |
496 | 498 |
497 void ChannelMojo::GetGenericRemoteAssociatedInterface( | 499 void ChannelMojo::GetGenericRemoteAssociatedInterface( |
498 const std::string& name, | 500 const std::string& name, |
499 mojo::ScopedInterfaceEndpointHandle handle) { | 501 mojo::ScopedInterfaceEndpointHandle handle) { |
500 if (message_reader_) | 502 if (message_reader_) |
501 message_reader_->GetRemoteInterface(name, std::move(handle)); | 503 message_reader_->GetRemoteInterface(name, std::move(handle)); |
502 } | 504 } |
503 | 505 |
504 } // namespace IPC | 506 } // namespace IPC |
OLD | NEW |