| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return MESSAGE_IS_TRUNCATED; | 60 return MESSAGE_IS_TRUNCATED; |
| 61 } | 61 } |
| 62 | 62 |
| 63 //------------------------------------------------------------------------------ | 63 //------------------------------------------------------------------------------ |
| 64 // This object allows the NaClDesc to hold a reference to a NaClIPCAdapter and | 64 // This object allows the NaClDesc to hold a reference to a NaClIPCAdapter and |
| 65 // forward calls to it. | 65 // forward calls to it. |
| 66 struct DescThunker { | 66 struct DescThunker { |
| 67 explicit DescThunker(NaClIPCAdapter* adapter_arg) | 67 explicit DescThunker(NaClIPCAdapter* adapter_arg) |
| 68 : adapter(adapter_arg) { | 68 : adapter(adapter_arg) { |
| 69 } | 69 } |
| 70 |
| 71 ~DescThunker() { adapter->CloseChannel(); } |
| 72 |
| 70 scoped_refptr<NaClIPCAdapter> adapter; | 73 scoped_refptr<NaClIPCAdapter> adapter; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(DescThunker); |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 NaClIPCAdapter* ToAdapter(void* handle) { | 78 NaClIPCAdapter* ToAdapter(void* handle) { |
| 74 return static_cast<DescThunker*>(handle)->adapter.get(); | 79 return static_cast<DescThunker*>(handle)->adapter.get(); |
| 75 } | 80 } |
| 76 | 81 |
| 77 // NaClDescCustom implementation. | 82 // NaClDescCustom implementation. |
| 78 void NaClDescCustomDestroy(void* handle) { | 83 void NaClDescCustomDestroy(void* handle) { |
| 79 delete static_cast<DescThunker*>(handle); | 84 delete static_cast<DescThunker*>(handle); |
| 80 } | 85 } |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 header.flags = msg.flags(); | 843 header.flags = msg.flags(); |
| 839 header.num_fds = static_cast<uint16_t>(rewritten_msg->desc_count()); | 844 header.num_fds = static_cast<uint16_t>(rewritten_msg->desc_count()); |
| 840 | 845 |
| 841 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 846 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
| 842 locked_data_.to_be_received_.push(std::move(rewritten_msg)); | 847 locked_data_.to_be_received_.push(std::move(rewritten_msg)); |
| 843 } | 848 } |
| 844 | 849 |
| 845 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 850 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
| 846 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 851 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
| 847 } | 852 } |
| OLD | NEW |