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