| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/loader/nacl_ipc_adapter.h" | 5 #include "components/nacl/loader/nacl_ipc_adapter.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 if (locked_data_.channel_closed_) { | 766 if (locked_data_.channel_closed_) { |
| 767 // If we ever pass handles from the plugin to the host, we should close them | 767 // If we ever pass handles from the plugin to the host, we should close them |
| 768 // here before we drop the message. | 768 // here before we drop the message. |
| 769 return false; | 769 return false; |
| 770 } | 770 } |
| 771 | 771 |
| 772 // Scan all untrusted messages. | 772 // Scan all untrusted messages. |
| 773 std::unique_ptr<IPC::Message> new_msg; | 773 std::unique_ptr<IPC::Message> new_msg; |
| 774 locked_data_.nacl_msg_scanner_.ScanUntrustedMessage(*msg, &new_msg); | 774 locked_data_.nacl_msg_scanner_.ScanUntrustedMessage(*msg, &new_msg); |
| 775 if (new_msg) | 775 if (new_msg) |
| 776 msg.reset(new_msg.release()); | 776 msg = std::move(new_msg); |
| 777 | 777 |
| 778 // Actual send must be done on the I/O thread. | 778 // Actual send must be done on the I/O thread. |
| 779 task_runner_->PostTask(FROM_HERE, | 779 task_runner_->PostTask(FROM_HERE, |
| 780 base::Bind(&NaClIPCAdapter::SendMessageOnIOThread, this, | 780 base::Bind(&NaClIPCAdapter::SendMessageOnIOThread, this, |
| 781 base::Passed(&msg))); | 781 base::Passed(&msg))); |
| 782 return true; | 782 return true; |
| 783 } | 783 } |
| 784 | 784 |
| 785 void NaClIPCAdapter::ClearToBeSent() { | 785 void NaClIPCAdapter::ClearToBeSent() { |
| 786 lock_.AssertAcquired(); | 786 lock_.AssertAcquired(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 header.flags = msg.flags(); | 842 header.flags = msg.flags(); |
| 843 header.num_fds = static_cast<uint16_t>(rewritten_msg->desc_count()); | 843 header.num_fds = static_cast<uint16_t>(rewritten_msg->desc_count()); |
| 844 | 844 |
| 845 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 845 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
| 846 locked_data_.to_be_received_.push(rewritten_msg); | 846 locked_data_.to_be_received_.push(rewritten_msg); |
| 847 } | 847 } |
| 848 | 848 |
| 849 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 849 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
| 850 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 850 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
| 851 } | 851 } |
| OLD | NEW |