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 #include "native_client/src/trusted/plugin/plugin_error.h" | 16 #include "native_client/src/trusted/plugin/plugin_error.h" |
17 #include "native_client/src/trusted/plugin/service_runtime.h" | 17 #include "native_client/src/trusted/plugin/service_runtime.h" |
18 | 18 |
19 #include "ppapi/cpp/completion_callback.h" | 19 #include "ppapi/cpp/completion_callback.h" |
20 | 20 |
21 namespace nacl { | 21 namespace nacl { |
22 class DescWrapper; | 22 class DescWrapper; |
23 } | 23 } |
24 | 24 |
25 | 25 |
26 namespace plugin { | 26 namespace plugin { |
27 | 27 |
| 28 class LocalTempFile; |
28 class Manifest; | 29 class Manifest; |
29 class NaClSubprocess; | 30 class NaClSubprocess; |
30 class Plugin; | 31 class Plugin; |
31 class PnaclResources; | 32 class PnaclResources; |
32 class TempFile; | 33 class TempFile; |
33 | 34 |
34 class PnaclTranslateThread { | 35 class PnaclTranslateThread { |
35 public: | 36 public: |
36 PnaclTranslateThread(); | 37 PnaclTranslateThread(); |
37 ~PnaclTranslateThread(); | 38 ~PnaclTranslateThread(); |
38 | 39 |
39 // Start the translation process. It will continue to run and consume data | 40 // Start the translation process. It will continue to run and consume data |
40 // as it is passed in with PutBytes. | 41 // as it is passed in with PutBytes. |
41 void RunTranslate(const pp::CompletionCallback& finish_callback, | 42 void RunTranslate(const pp::CompletionCallback& finish_callback, |
42 const Manifest* manifest, | 43 const Manifest* manifest, |
43 const Manifest* ld_manifest, | 44 const Manifest* ld_manifest, |
44 TempFile* obj_file, | 45 TempFile* obj_file, |
45 TempFile* nexe_file, | 46 LocalTempFile* nexe_file, |
46 ErrorInfo* error_info, | 47 ErrorInfo* error_info, |
47 PnaclResources* resources, | 48 PnaclResources* resources, |
48 Plugin* plugin); | 49 Plugin* plugin); |
49 | 50 |
50 // Signal the translate thread and subprocesses that they should stop. | 51 // Signal the translate thread and subprocesses that they should stop. |
51 void SetSubprocessesShouldDie(); | 52 void SetSubprocessesShouldDie(); |
52 | 53 |
53 // Send bitcode bytes to the translator. Called from the main thread. | 54 // Send bitcode bytes to the translator. Called from the main thread. |
54 void PutBytes(std::vector<char>* data, int count); | 55 void PutBytes(std::vector<char>* data, int count); |
55 | 56 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // main thread to the SRPC thread. Protected by cond_mu_ | 108 // main thread to the SRPC thread. Protected by cond_mu_ |
108 std::deque<std::vector<char> > data_buffers_; | 109 std::deque<std::vector<char> > data_buffers_; |
109 // Whether all data has been downloaded and copied to translation thread. | 110 // Whether all data has been downloaded and copied to translation thread. |
110 // Associated with buffer_cond_ | 111 // Associated with buffer_cond_ |
111 bool done_; | 112 bool done_; |
112 | 113 |
113 // Data about the translation files, owned by the coordinator | 114 // Data about the translation files, owned by the coordinator |
114 const Manifest* manifest_; | 115 const Manifest* manifest_; |
115 const Manifest* ld_manifest_; | 116 const Manifest* ld_manifest_; |
116 TempFile* obj_file_; | 117 TempFile* obj_file_; |
117 TempFile* nexe_file_; | 118 LocalTempFile* nexe_file_; |
118 ErrorInfo* coordinator_error_info_; | 119 ErrorInfo* coordinator_error_info_; |
119 PnaclResources* resources_; | 120 PnaclResources* resources_; |
120 Plugin* plugin_; | 121 Plugin* plugin_; |
121 private: | 122 private: |
122 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); | 123 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); |
123 }; | 124 }; |
124 | 125 |
125 } | 126 } |
126 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 127 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
OLD | NEW |