| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
| 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 class PnaclTranslateThread { | 44 class PnaclTranslateThread { |
| 45 public: | 45 public: |
| 46 PnaclTranslateThread(); | 46 PnaclTranslateThread(); |
| 47 ~PnaclTranslateThread(); | 47 ~PnaclTranslateThread(); |
| 48 | 48 |
| 49 // Start the translation process. It will continue to run and consume data | 49 // Start the translation process. It will continue to run and consume data |
| 50 // as it is passed in with PutBytes. | 50 // as it is passed in with PutBytes. |
| 51 void RunTranslate(const pp::CompletionCallback& finish_callback, | 51 void RunTranslate(const pp::CompletionCallback& finish_callback, |
| 52 const Manifest* manifest, | 52 const Manifest* manifest, |
| 53 TempFile* obj_file, | 53 const std::vector<TempFile*>* obj_files, |
| 54 TempFile* nexe_file, | 54 TempFile* nexe_file, |
| 55 ErrorInfo* error_info, | 55 ErrorInfo* error_info, |
| 56 PnaclResources* resources, | 56 PnaclResources* resources, |
| 57 PnaclOptions* pnacl_options, | 57 PnaclOptions* pnacl_options, |
| 58 PnaclCoordinator* coordinator, | 58 PnaclCoordinator* coordinator, |
| 59 Plugin* plugin); | 59 Plugin* plugin); |
| 60 | 60 |
| 61 // Kill the llc and/or ld subprocesses. This happens by closing the command | 61 // Kill the llc and/or ld subprocesses. This happens by closing the command |
| 62 // channel on the plugin side, which causes the trusted code in the nexe to | 62 // channel on the plugin side, which causes the trusted code in the nexe to |
| 63 // exit, which will cause any pending SRPCs to error. Because this is called | 63 // exit, which will cause any pending SRPCs to error. Because this is called |
| (...skipping 14 matching lines...) Expand all Loading... |
| 78 ErrorInfo* error_info); | 78 ErrorInfo* error_info); |
| 79 // Helper thread entry point for translation. Takes a pointer to | 79 // Helper thread entry point for translation. Takes a pointer to |
| 80 // PnaclTranslateThread and calls DoTranslate(). | 80 // PnaclTranslateThread and calls DoTranslate(). |
| 81 static void WINAPI DoTranslateThread(void* arg); | 81 static void WINAPI DoTranslateThread(void* arg); |
| 82 // Runs the streaming translation. Called from the helper thread. | 82 // Runs the streaming translation. Called from the helper thread. |
| 83 void DoTranslate() ; | 83 void DoTranslate() ; |
| 84 // Signal that Pnacl translation failed, from the translation thread only. | 84 // Signal that Pnacl translation failed, from the translation thread only. |
| 85 void TranslateFailed(enum PluginErrorCode err_code, | 85 void TranslateFailed(enum PluginErrorCode err_code, |
| 86 const nacl::string& error_string); | 86 const nacl::string& error_string); |
| 87 // Run the LD subprocess, returning true on success | 87 // Run the LD subprocess, returning true on success |
| 88 bool RunLdSubprocess(int is_shared_library, | 88 bool RunLdSubprocess(int modules_used, |
| 89 int is_shared_library, |
| 89 const nacl::string& soname, | 90 const nacl::string& soname, |
| 90 const nacl::string& lib_dependencies); | 91 const nacl::string& lib_dependencies); |
| 91 | 92 |
| 92 | 93 |
| 93 // Callback to run when tasks are completed or an error has occurred. | 94 // Callback to run when tasks are completed or an error has occurred. |
| 94 pp::CompletionCallback report_translate_finished_; | 95 pp::CompletionCallback report_translate_finished_; |
| 95 | 96 |
| 96 nacl::scoped_ptr<NaClThread> translate_thread_; | 97 nacl::scoped_ptr<NaClThread> translate_thread_; |
| 97 | 98 |
| 98 // Used to guard llc_subprocess and ld_subprocess | 99 // Used to guard llc_subprocess and ld_subprocess |
| (...skipping 15 matching lines...) Expand all Loading... |
| 114 // main thread to the SRPC thread. Protected by cond_mu_ | 115 // main thread to the SRPC thread. Protected by cond_mu_ |
| 115 std::deque<std::vector<char> > data_buffers_; | 116 std::deque<std::vector<char> > data_buffers_; |
| 116 // Whether all data has been downloaded and copied to translation thread. | 117 // Whether all data has been downloaded and copied to translation thread. |
| 117 // Associated with buffer_cond_ | 118 // Associated with buffer_cond_ |
| 118 bool done_; | 119 bool done_; |
| 119 | 120 |
| 120 PnaclTimeStats time_stats_; | 121 PnaclTimeStats time_stats_; |
| 121 | 122 |
| 122 // Data about the translation files, owned by the coordinator | 123 // Data about the translation files, owned by the coordinator |
| 123 const Manifest* manifest_; | 124 const Manifest* manifest_; |
| 124 TempFile* obj_file_; | 125 const std::vector<TempFile*>* obj_files_; |
| 125 TempFile* nexe_file_; | 126 TempFile* nexe_file_; |
| 126 ErrorInfo* coordinator_error_info_; | 127 ErrorInfo* coordinator_error_info_; |
| 127 PnaclResources* resources_; | 128 PnaclResources* resources_; |
| 128 PnaclOptions* pnacl_options_; | 129 PnaclOptions* pnacl_options_; |
| 129 PnaclCoordinator* coordinator_; | 130 PnaclCoordinator* coordinator_; |
| 130 Plugin* plugin_; | 131 Plugin* plugin_; |
| 131 private: | 132 private: |
| 132 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); | 133 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); |
| 133 }; | 134 }; |
| 134 | 135 |
| 135 } | 136 } |
| 136 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 137 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
| OLD | NEW |