| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/edk/system/node_channel.h" | 5 #include "mojo/edk/system/node_channel.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 base::AutoLock lock(remote_process_handle_lock_); | 764 base::AutoLock lock(remote_process_handle_lock_); |
| 765 remote_process_handle = remote_process_handle_; | 765 remote_process_handle = remote_process_handle_; |
| 766 } | 766 } |
| 767 PendingMessageQueue pending_writes; | 767 PendingMessageQueue pending_writes; |
| 768 PendingRelayMessageQueue pending_relays; | 768 PendingRelayMessageQueue pending_relays; |
| 769 { | 769 { |
| 770 base::AutoLock lock(pending_mach_messages_lock_); | 770 base::AutoLock lock(pending_mach_messages_lock_); |
| 771 pending_writes.swap(pending_write_messages_); | 771 pending_writes.swap(pending_write_messages_); |
| 772 pending_relays.swap(pending_relay_messages_); | 772 pending_relays.swap(pending_relay_messages_); |
| 773 } | 773 } |
| 774 DCHECK(pending_writes.empty() && pending_relays.empty()); | |
| 775 | 774 |
| 776 while (!pending_writes.empty()) { | 775 while (!pending_writes.empty()) { |
| 777 Channel::MessagePtr message = std::move(pending_writes.front()); | 776 Channel::MessagePtr message = std::move(pending_writes.front()); |
| 778 pending_writes.pop(); | 777 pending_writes.pop(); |
| 779 if (!relay->SendPortsToProcess(message.get(), remote_process_handle)) { | 778 if (!relay->SendPortsToProcess(message.get(), remote_process_handle)) { |
| 780 LOG(ERROR) << "Error on sending mach ports. Remote process is likely " | 779 LOG(ERROR) << "Error on sending mach ports. Remote process is likely " |
| 781 << "gone. Dropping message."; | 780 << "gone. Dropping message."; |
| 782 return; | 781 return; |
| 783 } | 782 } |
| 784 | 783 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 | 866 |
| 868 base::AutoLock lock(channel_lock_); | 867 base::AutoLock lock(channel_lock_); |
| 869 if (!channel_) | 868 if (!channel_) |
| 870 DLOG(ERROR) << "Dropping message on closed channel."; | 869 DLOG(ERROR) << "Dropping message on closed channel."; |
| 871 else | 870 else |
| 872 channel_->Write(std::move(message)); | 871 channel_->Write(std::move(message)); |
| 873 } | 872 } |
| 874 | 873 |
| 875 } // namespace edk | 874 } // namespace edk |
| 876 } // namespace mojo | 875 } // namespace mojo |
| OLD | NEW |