| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Kill the llc and/or ld subprocesses. This happens by closing the command | 55 // Kill the llc and/or ld subprocesses. This happens by closing the command |
| 56 // channel on the plugin side, which causes the trusted code in the nexe to | 56 // channel on the plugin side, which causes the trusted code in the nexe to |
| 57 // exit, which will cause any pending SRPCs to error. Because this is called | 57 // exit, which will cause any pending SRPCs to error. Because this is called |
| 58 // on the main thread, the translation thread must not use the subprocess | 58 // on the main thread, the translation thread must not use the subprocess |
| 59 // objects without the lock, other than InvokeSrpcMethod, which does not | 59 // objects without the lock, other than InvokeSrpcMethod, which does not |
| 60 // race with service runtime shutdown. | 60 // race with service runtime shutdown. |
| 61 void AbortSubprocesses(); | 61 void AbortSubprocesses(); |
| 62 | 62 |
| 63 // Send bitcode bytes to the translator. Called from the main thread. | 63 // Send bitcode bytes to the translator. Called from the main thread. |
| 64 void PutBytes(std::vector<char>* data, int count); | 64 void PutBytes(const void* data, int count); |
| 65 | 65 |
| 66 // Notify the translator that the end of the bitcode stream has been reached. | 66 // Notify the translator that the end of the bitcode stream has been reached. |
| 67 // Called from the main thread. | 67 // Called from the main thread. |
| 68 void EndStream(); | 68 void EndStream(); |
| 69 | 69 |
| 70 int64_t GetCompileTime() const { return compile_time_; } | 70 int64_t GetCompileTime() const { return compile_time_; } |
| 71 | 71 |
| 72 // Returns true if RunTranslate() has been called, false otherwise. |
| 73 bool started() const { return plugin_ != NULL; } |
| 74 |
| 72 private: | 75 private: |
| 73 // Helper thread entry point for translation. Takes a pointer to | 76 // Helper thread entry point for translation. Takes a pointer to |
| 74 // PnaclTranslateThread and calls DoTranslate(). | 77 // PnaclTranslateThread and calls DoTranslate(). |
| 75 static void WINAPI DoTranslateThread(void* arg); | 78 static void WINAPI DoTranslateThread(void* arg); |
| 76 // Runs the streaming translation. Called from the helper thread. | 79 // Runs the streaming translation. Called from the helper thread. |
| 77 void DoTranslate() ; | 80 void DoTranslate() ; |
| 78 // Signal that Pnacl translation failed, from the translation thread only. | 81 // Signal that Pnacl translation failed, from the translation thread only. |
| 79 void TranslateFailed(PP_NaClError err_code, | 82 void TranslateFailed(PP_NaClError err_code, |
| 80 const nacl::string& error_string); | 83 const nacl::string& error_string); |
| 81 // Run the LD subprocess, returning true on success. | 84 // Run the LD subprocess, returning true on success. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 PP_PNaClOptions* pnacl_options_; | 126 PP_PNaClOptions* pnacl_options_; |
| 124 nacl::string architecture_attributes_; | 127 nacl::string architecture_attributes_; |
| 125 PnaclCoordinator* coordinator_; | 128 PnaclCoordinator* coordinator_; |
| 126 Plugin* plugin_; | 129 Plugin* plugin_; |
| 127 private: | 130 private: |
| 128 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); | 131 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); |
| 129 }; | 132 }; |
| 130 | 133 |
| 131 } | 134 } |
| 132 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 135 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
| OLD | NEW |