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 | 14 |
15 #include "ppapi/cpp/completion_callback.h" | 15 #include "ppapi/cpp/completion_callback.h" |
16 | 16 |
17 namespace nacl { | 17 namespace nacl { |
18 class DescWrapper; | 18 class DescWrapper; |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 namespace plugin { | 22 namespace plugin { |
23 | 23 |
24 class LocalTempFile; | 24 class LocalTempFile; |
25 class Manifest; | 25 class Manifest; |
26 class NaClSubprocess; | 26 class NaClSubprocess; |
27 class Plugin; | 27 class Plugin; |
28 class PnaclResources; | 28 class PnaclResources; |
| 29 class TempFile; |
29 | 30 |
30 class PnaclTranslateThread { | 31 class PnaclTranslateThread { |
31 public: | 32 public: |
32 PnaclTranslateThread(); | 33 PnaclTranslateThread(); |
33 virtual ~PnaclTranslateThread(); | 34 virtual ~PnaclTranslateThread(); |
34 // TODO(jvoung/dschuff): handle surfaway issues when coordinator/plugin | 35 // TODO(jvoung/dschuff): handle surfaway issues when coordinator/plugin |
35 // goes away. This data may have to be refcounted not touched in that case. | 36 // goes away. This data may have to be refcounted not touched in that case. |
36 virtual void RunTranslate(const pp::CompletionCallback& finish_callback, | 37 virtual void RunTranslate(const pp::CompletionCallback& finish_callback, |
37 const Manifest* manifest, | 38 const Manifest* manifest, |
38 const Manifest* ld_manifest, | 39 const Manifest* ld_manifest, |
39 LocalTempFile* obj_file, | 40 TempFile* obj_file, |
40 LocalTempFile* nexe_file, | 41 LocalTempFile* nexe_file, |
41 ErrorInfo* error_info, | 42 ErrorInfo* error_info, |
42 PnaclResources* resources, | 43 PnaclResources* resources, |
43 Plugin* plugin) = 0; | 44 Plugin* plugin) = 0; |
44 // Returns true if the translate thread and subprocesses should stop. | 45 // Returns true if the translate thread and subprocesses should stop. |
45 bool SubprocessesShouldDie(); | 46 bool SubprocessesShouldDie(); |
46 // Signal the translate thread and subprocesses that they should stop. | 47 // Signal the translate thread and subprocesses that they should stop. |
47 virtual void SetSubprocessesShouldDie(); | 48 virtual void SetSubprocessesShouldDie(); |
48 | 49 |
49 protected: | 50 protected: |
(...skipping 18 matching lines...) Expand all Loading... |
68 // True if the translation thread and related subprocesses should exit. | 69 // True if the translation thread and related subprocesses should exit. |
69 bool subprocesses_should_die_; | 70 bool subprocesses_should_die_; |
70 // Used to guard and publish subprocesses_should_die_. | 71 // Used to guard and publish subprocesses_should_die_. |
71 struct NaClMutex subprocess_mu_; | 72 struct NaClMutex subprocess_mu_; |
72 | 73 |
73 nacl::scoped_ptr<NaClThread> translate_thread_; | 74 nacl::scoped_ptr<NaClThread> translate_thread_; |
74 | 75 |
75 // Data about the translation files, owned by the coordinator | 76 // Data about the translation files, owned by the coordinator |
76 const Manifest* manifest_; | 77 const Manifest* manifest_; |
77 const Manifest* ld_manifest_; | 78 const Manifest* ld_manifest_; |
78 LocalTempFile* obj_file_; | 79 TempFile* obj_file_; |
79 LocalTempFile* nexe_file_; | 80 LocalTempFile* nexe_file_; |
80 ErrorInfo* coordinator_error_info_; | 81 ErrorInfo* coordinator_error_info_; |
81 PnaclResources* resources_; | 82 PnaclResources* resources_; |
82 Plugin* plugin_; | 83 Plugin* plugin_; |
83 private: | 84 private: |
84 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); | 85 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclTranslateThread); |
85 }; | 86 }; |
86 | 87 |
87 } | 88 } |
88 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ | 89 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_TRANSLATE_THREAD_H_ |
OLD | NEW |