| 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 COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 5 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
| 6 #define COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 6 #define COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "components/nacl/renderer/plugin/plugin_error.h" | 14 #include "components/nacl/renderer/plugin/plugin_error.h" |
| 15 #include "native_client/src/include/nacl_macros.h" | 15 #include "native_client/src/include/nacl_macros.h" |
| 16 #include "native_client/src/include/nacl_scoped_ptr.h" | 16 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 17 #include "native_client/src/shared/platform/nacl_sync_checked.h" | 17 #include "native_client/src/shared/platform/nacl_sync_checked.h" |
| 18 #include "native_client/src/shared/platform/nacl_threads.h" | 18 #include "native_client/src/shared/platform/nacl_threads.h" |
| 19 #include "ppapi/cpp/completion_callback.h" | 19 #include "ppapi/cpp/completion_callback.h" |
| 20 #include "ppapi/proxy/serialized_handle.h" |
| 20 | 21 |
| 21 struct PP_PNaClOptions; | 22 struct PP_PNaClOptions; |
| 22 | 23 |
| 23 namespace nacl { | 24 namespace nacl { |
| 24 class DescWrapper; | 25 class DescWrapper; |
| 25 } | 26 } |
| 26 | 27 |
| 27 | 28 |
| 28 namespace plugin { | 29 namespace plugin { |
| 29 | 30 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Notify the translator that the end of the bitcode stream has been reached. | 78 // Notify the translator that the end of the bitcode stream has been reached. |
| 78 // Called from the main thread. | 79 // Called from the main thread. |
| 79 void EndStream(); | 80 void EndStream(); |
| 80 | 81 |
| 81 int64_t GetCompileTime() const { return compile_time_; } | 82 int64_t GetCompileTime() const { return compile_time_; } |
| 82 | 83 |
| 83 // Returns true if the translation process is initiated via SetupState. | 84 // Returns true if the translation process is initiated via SetupState. |
| 84 bool started() const { return coordinator_ != NULL; } | 85 bool started() const { return coordinator_ != NULL; } |
| 85 | 86 |
| 86 private: | 87 private: |
| 88 ppapi::proxy::SerializedHandle GetHandleForSubprocess(TempFile* file, |
| 89 int32_t open_flags); |
| 90 |
| 87 // Helper thread entry point for compilation. Takes a pointer to | 91 // Helper thread entry point for compilation. Takes a pointer to |
| 88 // PnaclTranslateThread and calls DoCompile(). | 92 // PnaclTranslateThread and calls DoCompile(). |
| 89 static void WINAPI DoCompileThread(void* arg); | 93 static void WINAPI DoCompileThread(void* arg); |
| 90 // Runs the streaming compilation. Called from the helper thread. | 94 // Runs the streaming compilation. Called from the helper thread. |
| 91 void DoCompile(); | 95 void DoCompile(); |
| 92 | 96 |
| 93 // Similar to DoCompile*, but for linking. | 97 // Similar to DoCompile*, but for linking. |
| 94 static void WINAPI DoLinkThread(void* arg); | 98 static void WINAPI DoLinkThread(void* arg); |
| 95 void DoLink(); | 99 void DoLink(); |
| 96 | 100 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 146 |
| 143 // Data about the translation files, owned by the coordinator | 147 // Data about the translation files, owned by the coordinator |
| 144 const std::vector<TempFile*>* obj_files_; | 148 const std::vector<TempFile*>* obj_files_; |
| 145 int num_threads_; | 149 int num_threads_; |
| 146 TempFile* nexe_file_; | 150 TempFile* nexe_file_; |
| 147 nacl::DescWrapper* invalid_desc_wrapper_; | 151 nacl::DescWrapper* invalid_desc_wrapper_; |
| 148 ErrorInfo* coordinator_error_info_; | 152 ErrorInfo* coordinator_error_info_; |
| 149 PP_PNaClOptions* pnacl_options_; | 153 PP_PNaClOptions* pnacl_options_; |
| 150 std::string architecture_attributes_; | 154 std::string architecture_attributes_; |
| 151 PnaclCoordinator* coordinator_; | 155 PnaclCoordinator* coordinator_; |
| 156 |
| 157 // This IPC::SyncChannel can only be used and freed by the parent thread. |
| 158 scoped_ptr<IPC::SyncChannel> ld_channel_; |
| 159 // This IPC::SyncMessageFilter can be used by the child thread. |
| 160 scoped_refptr<IPC::SyncMessageFilter> ld_channel_filter_; |
| 161 // PID of the subprocess, needed for copying handles to the subprocess on |
| 162 // Windows. This is used by the child thread. |
| 163 base::ProcessId ld_channel_peer_pid_; |
| 164 |
| 152 private: | 165 private: |
| 153 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); | 166 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); |
| 154 }; | 167 }; |
| 155 | 168 |
| 156 } | 169 } |
| 157 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 170 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
| OLD | NEW |