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 "base/macros.h" | 5 #include "base/macros.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "ipc/ipc_listener.h" | 7 #include "ipc/ipc_listener.h" |
8 #include "ipc/ipc_sync_channel.h" | 8 #include "ipc/ipc_sync_channel.h" |
9 #include "native_client/src/public/chrome_main.h" | 9 #include "native_client/src/public/chrome_main.h" |
10 #include "native_client/src/untrusted/irt/irt_dev.h" | 10 #include "native_client/src/untrusted/irt/irt_dev.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 obj_file_fds[i] = obj_files[i].descriptor().fd; | 56 obj_file_fds[i] = obj_files[i].descriptor().fd; |
57 } | 57 } |
58 int result = func_(nexe_file.descriptor().fd, | 58 int result = func_(nexe_file.descriptor().fd, |
59 obj_file_fds.data(), | 59 obj_file_fds.data(), |
60 obj_file_fds.size()); | 60 obj_file_fds.size()); |
61 bool success = (result == 0); | 61 bool success = (result == 0); |
62 PpapiMsg_PnaclTranslatorLink::WriteReplyParams(reply_msg, success); | 62 PpapiMsg_PnaclTranslatorLink::WriteReplyParams(reply_msg, success); |
63 Send(reply_msg); | 63 Send(reply_msg); |
64 } | 64 } |
65 | 65 |
66 scoped_ptr<IPC::Channel> channel_; | 66 std::unique_ptr<IPC::Channel> channel_; |
67 CallbackFunc func_; | 67 CallbackFunc func_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(TranslatorLinkListener); | 69 DISALLOW_COPY_AND_ASSIGN(TranslatorLinkListener); |
70 }; | 70 }; |
71 | 71 |
72 void ServeLinkRequest(CallbackFunc func) { | 72 void ServeLinkRequest(CallbackFunc func) { |
73 base::MessageLoop loop; | 73 base::MessageLoop loop; |
74 int fd = ppapi::GetRendererIPCFileDescriptor(); | 74 int fd = ppapi::GetRendererIPCFileDescriptor(); |
75 IPC::ChannelHandle handle("NaCl IPC", base::FileDescriptor(fd, false)); | 75 IPC::ChannelHandle handle("NaCl IPC", base::FileDescriptor(fd, false)); |
76 new TranslatorLinkListener(handle, func); | 76 new TranslatorLinkListener(handle, func); |
77 loop.Run(); | 77 loop.Run(); |
78 } | 78 } |
79 | 79 |
80 } | 80 } |
81 | 81 |
82 const struct nacl_irt_private_pnacl_translator_link | 82 const struct nacl_irt_private_pnacl_translator_link |
83 nacl_irt_private_pnacl_translator_link = { | 83 nacl_irt_private_pnacl_translator_link = { |
84 ServeLinkRequest | 84 ServeLinkRequest |
85 }; | 85 }; |
86 | 86 |
87 #endif // !defined(OS_NACL_NONSFI) | 87 #endif // !defined(OS_NACL_NONSFI) |
OLD | NEW |