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 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Used to guard compiler_subprocess, ld_subprocess, | 106 // Used to guard compiler_subprocess, ld_subprocess, |
107 // compiler_subprocess_active_, and ld_subprocess_active_ | 107 // compiler_subprocess_active_, and ld_subprocess_active_ |
108 // (touched by the main thread and the translate thread). | 108 // (touched by the main thread and the translate thread). |
109 struct NaClMutex subprocess_mu_; | 109 struct NaClMutex subprocess_mu_; |
110 // The compiler_subprocess and ld_subprocess memory is owned by the | 110 // The compiler_subprocess and ld_subprocess memory is owned by the |
111 // coordinator so we do not delete them. However, the main thread delegates | 111 // coordinator so we do not delete them. However, the main thread delegates |
112 // shutdown to this thread, since this thread may still be accessing the | 112 // shutdown to this thread, since this thread may still be accessing the |
113 // subprocesses. The *_subprocess_active flags indicate which subprocesses | 113 // subprocesses. The *_subprocess_active flags indicate which subprocesses |
114 // are active to ensure the subprocesses don't get shutdown more than once. | 114 // are active to ensure the subprocesses don't get shutdown more than once. |
115 // The subprocess_mu_ must be held when shutting down the subprocesses | 115 // The subprocess_mu_ must be held when shutting down the subprocesses |
116 // or checking if it's already shut down (via the active flags). | 116 // or otherwise accessing the service_runtime component of the subprocess. |
117 // There are some accesses to the subprocesses without locks held | 117 // There are some accesses to the subprocesses without locks held |
118 // (invoking SRPC methods client). | 118 // (invoking srpc_client methods -- in contrast to using the service_runtime). |
119 NaClSubprocess* compiler_subprocess_; | 119 NaClSubprocess* compiler_subprocess_; |
120 NaClSubprocess* ld_subprocess_; | 120 NaClSubprocess* ld_subprocess_; |
121 bool compiler_subprocess_active_; | 121 bool compiler_subprocess_active_; |
122 bool ld_subprocess_active_; | 122 bool ld_subprocess_active_; |
123 | 123 |
124 // Condition variable to synchronize communication with the SRPC thread. | 124 // Condition variable to synchronize communication with the SRPC thread. |
125 // SRPC thread waits on this condvar if data_buffers_ is empty (meaning | 125 // SRPC thread waits on this condvar if data_buffers_ is empty (meaning |
126 // there is no bitcode to send to the translator), and the main thread | 126 // there is no bitcode to send to the translator), and the main thread |
127 // appends to data_buffers_ and signals it when it receives bitcode. | 127 // appends to data_buffers_ and signals it when it receives bitcode. |
128 struct NaClCondVar buffer_cond_; | 128 struct NaClCondVar buffer_cond_; |
(...skipping 16 matching lines...) Expand all Loading... |
145 ErrorInfo* coordinator_error_info_; | 145 ErrorInfo* coordinator_error_info_; |
146 PP_PNaClOptions* pnacl_options_; | 146 PP_PNaClOptions* pnacl_options_; |
147 std::string architecture_attributes_; | 147 std::string architecture_attributes_; |
148 PnaclCoordinator* coordinator_; | 148 PnaclCoordinator* coordinator_; |
149 private: | 149 private: |
150 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); | 150 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); |
151 }; | 151 }; |
152 | 152 |
153 } | 153 } |
154 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 154 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
OLD | NEW |