| 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/untrusted/irt/irt_dev.h" | 9 #include "native_client/src/untrusted/irt/irt_dev.h" |
| 10 #include "ppapi/nacl_irt/irt_interfaces.h" | 10 #include "ppapi/nacl_irt/irt_interfaces.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 void OnPnaclTranslatorCompileEnd(IPC::Message* reply_msg) { | 86 void OnPnaclTranslatorCompileEnd(IPC::Message* reply_msg) { |
| 87 char* error_cstr = funcs_->end_callback(); | 87 char* error_cstr = funcs_->end_callback(); |
| 88 bool success = !error_cstr; | 88 bool success = !error_cstr; |
| 89 std::string error_str(error_cstr ? error_cstr : ""); | 89 std::string error_str(error_cstr ? error_cstr : ""); |
| 90 PpapiMsg_PnaclTranslatorCompileEnd::WriteReplyParams( | 90 PpapiMsg_PnaclTranslatorCompileEnd::WriteReplyParams( |
| 91 reply_msg, success, error_str); | 91 reply_msg, success, error_str); |
| 92 Send(reply_msg); | 92 Send(reply_msg); |
| 93 } | 93 } |
| 94 | 94 |
| 95 scoped_ptr<IPC::Channel> channel_; | 95 std::unique_ptr<IPC::Channel> channel_; |
| 96 const struct nacl_irt_pnacl_compile_funcs* funcs_; | 96 const struct nacl_irt_pnacl_compile_funcs* funcs_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(TranslatorCompileListener); | 98 DISALLOW_COPY_AND_ASSIGN(TranslatorCompileListener); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 void ServeTranslateRequest(const struct nacl_irt_pnacl_compile_funcs* funcs) { | 101 void ServeTranslateRequest(const struct nacl_irt_pnacl_compile_funcs* funcs) { |
| 102 base::MessageLoop loop; | 102 base::MessageLoop loop; |
| 103 int fd = ppapi::GetRendererIPCFileDescriptor(); | 103 int fd = ppapi::GetRendererIPCFileDescriptor(); |
| 104 IPC::ChannelHandle handle("NaCl IPC", base::FileDescriptor(fd, false)); | 104 IPC::ChannelHandle handle("NaCl IPC", base::FileDescriptor(fd, false)); |
| 105 new TranslatorCompileListener(handle, funcs); | 105 new TranslatorCompileListener(handle, funcs); |
| 106 loop.Run(); | 106 loop.Run(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } | 109 } |
| 110 | 110 |
| 111 const struct nacl_irt_private_pnacl_translator_compile | 111 const struct nacl_irt_private_pnacl_translator_compile |
| 112 nacl_irt_private_pnacl_translator_compile = { | 112 nacl_irt_private_pnacl_translator_compile = { |
| 113 ServeTranslateRequest | 113 ServeTranslateRequest |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 #endif // !defined(OS_NACL_NONSFI) | 116 #endif // !defined(OS_NACL_NONSFI) |
| OLD | NEW |