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