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 "native_client/src/include/nacl_macros.h" | 8 #include "native_client/src/include/nacl_macros.h" |
9 #include "native_client/src/include/nacl_scoped_ptr.h" | 9 #include "native_client/src/include/nacl_scoped_ptr.h" |
10 #include "native_client/src/include/nacl_string.h" | 10 #include "native_client/src/include/nacl_string.h" |
11 #include "native_client/src/shared/platform/nacl_threads.h" | 11 #include "native_client/src/shared/platform/nacl_threads.h" |
12 #include "native_client/src/shared/platform/nacl_sync_checked.h" | 12 #include "native_client/src/shared/platform/nacl_sync_checked.h" |
13 #include "native_client/src/trusted/plugin/plugin_error.h" | 13 #include "native_client/src/trusted/plugin/plugin_error.h" |
14 #include "native_client/src/trusted/plugin/service_runtime.h" | |
14 | 15 |
15 #include "ppapi/cpp/completion_callback.h" | 16 #include "ppapi/cpp/completion_callback.h" |
16 | 17 |
17 namespace nacl { | 18 namespace nacl { |
18 class DescWrapper; | 19 class DescWrapper; |
19 } | 20 } |
20 | 21 |
21 | 22 |
22 namespace plugin { | 23 namespace plugin { |
23 | 24 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 static void WINAPI DoTranslateThread(void* arg); | 58 static void WINAPI DoTranslateThread(void* arg); |
58 // Runs the SRPCs that control translation. Called from the helper thread. | 59 // Runs the SRPCs that control translation. Called from the helper thread. |
59 virtual void DoTranslate() = 0; | 60 virtual void DoTranslate() = 0; |
60 // Signal that Pnacl translation failed, from the translation thread only. | 61 // Signal that Pnacl translation failed, from the translation thread only. |
61 void TranslateFailed(const nacl::string& error_string); | 62 void TranslateFailed(const nacl::string& error_string); |
62 // Run the LD subprocess, returning true on success | 63 // Run the LD subprocess, returning true on success |
63 bool RunLdSubprocess(int is_shared_library, | 64 bool RunLdSubprocess(int is_shared_library, |
64 const nacl::string& soname, | 65 const nacl::string& soname, |
65 const nacl::string& lib_dependencies); | 66 const nacl::string& lib_dependencies); |
66 | 67 |
68 // Register a reverse service interface which will be shutdown if the | |
69 // plugin is shutdown. The reverse service pointer must be available on the | |
70 // main thread because the translation thread could be blocked on SRPC | |
71 // waiting for the translator, which could be waiting on a reverse | |
72 // service call. | |
73 void RegisterReverseInterface(PluginReverseInterface *interface); | |
74 | |
67 // Callback to run when tasks are completed or an error has occurred. | 75 // Callback to run when tasks are completed or an error has occurred. |
68 pp::CompletionCallback report_translate_finished_; | 76 pp::CompletionCallback report_translate_finished_; |
69 // True if the translation thread and related subprocesses should exit. | 77 // True if the translation thread and related subprocesses should exit. |
70 bool subprocesses_should_die_; | 78 bool subprocesses_should_die_; |
71 // Used to guard and publish subprocesses_should_die_. | 79 // Used to guard and publish subprocesses_should_die_. |
72 struct NaClMutex subprocess_mu_; | 80 struct NaClMutex subprocess_mu_; |
73 | 81 |
74 nacl::scoped_ptr<NaClThread> translate_thread_; | 82 nacl::scoped_ptr<NaClThread> translate_thread_; |
75 | 83 |
84 // Reverse interface to shutdown on SetSubprocessesShouldDie | |
85 PluginReverseInterface *current_rev_interface_; | |
robertm
2012/07/31 17:22:18
"*" to the left
Derek Schuff
2012/07/31 17:41:28
Done.
| |
86 | |
76 // Data about the translation files, owned by the coordinator | 87 // Data about the translation files, owned by the coordinator |
77 const Manifest* manifest_; | 88 const Manifest* manifest_; |
78 const Manifest* ld_manifest_; | 89 const Manifest* ld_manifest_; |
79 TempFile* obj_file_; | 90 TempFile* obj_file_; |
80 LocalTempFile* nexe_file_; | 91 LocalTempFile* nexe_file_; |
81 ErrorInfo* coordinator_error_info_; | 92 ErrorInfo* coordinator_error_info_; |
82 PnaclResources* resources_; | 93 PnaclResources* resources_; |
83 Plugin* plugin_; | 94 Plugin* plugin_; |
84 private: | 95 private: |
85 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); | 96 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); |
86 }; | 97 }; |
87 | 98 |
88 } | 99 } |
89 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 100 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
OLD | NEW |