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 |
11 #include "native_client/src/include/nacl_macros.h" | 11 #include "native_client/src/include/nacl_macros.h" |
12 #include "native_client/src/include/nacl_scoped_ptr.h" | 12 #include "native_client/src/include/nacl_scoped_ptr.h" |
13 #include "native_client/src/include/nacl_string.h" | 13 #include "native_client/src/include/nacl_string.h" |
14 #include "native_client/src/shared/platform/nacl_threads.h" | 14 #include "native_client/src/shared/platform/nacl_threads.h" |
15 #include "native_client/src/shared/platform/nacl_sync_checked.h" | 15 #include "native_client/src/shared/platform/nacl_sync_checked.h" |
16 | 16 |
17 #include "ppapi/cpp/completion_callback.h" | 17 #include "ppapi/cpp/completion_callback.h" |
18 | 18 |
19 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" | 19 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" |
20 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" | 20 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" |
21 | 21 |
| 22 struct PP_PNaClOptions; |
| 23 |
22 namespace nacl { | 24 namespace nacl { |
23 class DescWrapper; | 25 class DescWrapper; |
24 } | 26 } |
25 | 27 |
26 | 28 |
27 namespace plugin { | 29 namespace plugin { |
28 | 30 |
29 class Manifest; | 31 class Manifest; |
30 class NaClSubprocess; | 32 class NaClSubprocess; |
31 class Plugin; | 33 class Plugin; |
32 class PnaclCoordinator; | 34 class PnaclCoordinator; |
33 class PnaclOptions; | |
34 class PnaclResources; | 35 class PnaclResources; |
35 class TempFile; | 36 class TempFile; |
36 | 37 |
37 class PnaclTranslateThread { | 38 class PnaclTranslateThread { |
38 public: | 39 public: |
39 PnaclTranslateThread(); | 40 PnaclTranslateThread(); |
40 ~PnaclTranslateThread(); | 41 ~PnaclTranslateThread(); |
41 | 42 |
42 // Start the translation process. It will continue to run and consume data | 43 // Start the translation process. It will continue to run and consume data |
43 // as it is passed in with PutBytes. | 44 // as it is passed in with PutBytes. |
44 void RunTranslate(const pp::CompletionCallback& finish_callback, | 45 void RunTranslate(const pp::CompletionCallback& finish_callback, |
45 const Manifest* manifest, | 46 const Manifest* manifest, |
46 const std::vector<TempFile*>* obj_files, | 47 const std::vector<TempFile*>* obj_files, |
47 TempFile* nexe_file, | 48 TempFile* nexe_file, |
48 nacl::DescWrapper* invalid_desc_wrapper, | 49 nacl::DescWrapper* invalid_desc_wrapper, |
49 ErrorInfo* error_info, | 50 ErrorInfo* error_info, |
50 PnaclResources* resources, | 51 PnaclResources* resources, |
51 PnaclOptions* pnacl_options, | 52 PP_PNaClOptions* pnacl_options, |
52 PnaclCoordinator* coordinator, | 53 PnaclCoordinator* coordinator, |
53 Plugin* plugin); | 54 Plugin* plugin); |
54 | 55 |
55 // Kill the llc and/or ld subprocesses. This happens by closing the command | 56 // 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 | 57 // 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 | 58 // 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 | 59 // on the main thread, the translation thread must not use the subprocess |
59 // objects without the lock, other than InvokeSrpcMethod, which does not | 60 // objects without the lock, other than InvokeSrpcMethod, which does not |
60 // race with service runtime shutdown. | 61 // race with service runtime shutdown. |
61 void AbortSubprocesses(); | 62 void AbortSubprocesses(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 113 |
113 int64_t compile_time_; | 114 int64_t compile_time_; |
114 | 115 |
115 // Data about the translation files, owned by the coordinator | 116 // Data about the translation files, owned by the coordinator |
116 const Manifest* manifest_; | 117 const Manifest* manifest_; |
117 const std::vector<TempFile*>* obj_files_; | 118 const std::vector<TempFile*>* obj_files_; |
118 TempFile* nexe_file_; | 119 TempFile* nexe_file_; |
119 nacl::DescWrapper* invalid_desc_wrapper_; | 120 nacl::DescWrapper* invalid_desc_wrapper_; |
120 ErrorInfo* coordinator_error_info_; | 121 ErrorInfo* coordinator_error_info_; |
121 PnaclResources* resources_; | 122 PnaclResources* resources_; |
122 PnaclOptions* pnacl_options_; | 123 PP_PNaClOptions* pnacl_options_; |
123 PnaclCoordinator* coordinator_; | 124 PnaclCoordinator* coordinator_; |
124 Plugin* plugin_; | 125 Plugin* plugin_; |
125 private: | 126 private: |
126 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); | 127 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); |
127 }; | 128 }; |
128 | 129 |
129 } | 130 } |
130 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 131 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
OLD | NEW |