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_COORDINATOR_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "native_client/src/include/nacl_macros.h" | 12 #include "native_client/src/include/nacl_macros.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_sync_raii.h" | 14 #include "native_client/src/shared/platform/nacl_sync_raii.h" |
15 #include "native_client/src/shared/srpc/nacl_srpc.h" | 15 #include "native_client/src/shared/srpc/nacl_srpc.h" |
16 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 16 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
17 | 17 |
18 #include "ppapi/cpp/completion_callback.h" | 18 #include "ppapi/cpp/completion_callback.h" |
19 | 19 |
20 #include "ppapi/native_client/src/trusted/plugin/callback_source.h" | 20 #include "ppapi/native_client/src/trusted/plugin/callback_source.h" |
21 #include "ppapi/native_client/src/trusted/plugin/file_downloader.h" | 21 #include "ppapi/native_client/src/trusted/plugin/file_downloader.h" |
22 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h" | 22 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h" |
23 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" | 23 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" |
24 #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h" | 24 #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h" |
25 | 25 |
26 struct PP_PNaClOptions; | 26 struct PP_PNaClOptions; |
27 | 27 |
28 namespace plugin { | 28 namespace plugin { |
29 | 29 |
30 class Manifest; | |
31 class Plugin; | 30 class Plugin; |
32 class PnaclCoordinator; | 31 class PnaclCoordinator; |
33 class PnaclTranslateThread; | 32 class PnaclTranslateThread; |
34 class TempFile; | 33 class TempFile; |
35 | 34 |
36 // A class invoked by Plugin to handle PNaCl client-side translation. | 35 // A class invoked by Plugin to handle PNaCl client-side translation. |
37 // Usage: | 36 // Usage: |
38 // (1) Invoke the factory method, e.g., | 37 // (1) Invoke the factory method, e.g., |
39 // PnaclCoordinator* coord = BitcodeToNative(plugin, | 38 // PnaclCoordinator* coord = BitcodeToNative(plugin, |
40 // "http://foo.com/my.pexe", | 39 // "http://foo.com/my.pexe", |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // notified via ReportTranslationFinished. If it is not set before | 196 // notified via ReportTranslationFinished. If it is not set before |
198 // plugin/coordinator destruction, the destructor will call | 197 // plugin/coordinator destruction, the destructor will call |
199 // ReportTranslationFinished. | 198 // ReportTranslationFinished. |
200 bool translation_finished_reported_; | 199 bool translation_finished_reported_; |
201 // Threadsafety is required to support file lookups. | 200 // Threadsafety is required to support file lookups. |
202 pp::CompletionCallbackFactory<PnaclCoordinator, | 201 pp::CompletionCallbackFactory<PnaclCoordinator, |
203 pp::ThreadSafeThreadTraits> callback_factory_; | 202 pp::ThreadSafeThreadTraits> callback_factory_; |
204 | 203 |
205 // The manifest used by resource loading and ld + llc's reverse service | 204 // The manifest used by resource loading and ld + llc's reverse service |
206 // to look up objects and libraries. | 205 // to look up objects and libraries. |
207 nacl::scoped_ptr<const Manifest> manifest_; | 206 int32_t manifest_id_; |
208 // An auxiliary class that manages downloaded resources (llc and ld nexes). | 207 // An auxiliary class that manages downloaded resources (llc and ld nexes). |
209 nacl::scoped_ptr<PnaclResources> resources_; | 208 nacl::scoped_ptr<PnaclResources> resources_; |
210 | 209 |
211 // The URL for the pexe file. | 210 // The URL for the pexe file. |
212 nacl::string pexe_url_; | 211 nacl::string pexe_url_; |
213 // Options for translation. | 212 // Options for translation. |
214 PP_PNaClOptions pnacl_options_; | 213 PP_PNaClOptions pnacl_options_; |
215 | 214 |
216 // Object file, produced by the translator and consumed by the linker. | 215 // Object file, produced by the translator and consumed by the linker. |
217 std::vector<TempFile*> obj_files_; | 216 std::vector<TempFile*> obj_files_; |
(...skipping 27 matching lines...) Expand all Loading... |
245 // The helper thread used to do translations via SRPC. | 244 // The helper thread used to do translations via SRPC. |
246 // It accesses fields of PnaclCoordinator so it must have a | 245 // It accesses fields of PnaclCoordinator so it must have a |
247 // shorter lifetime. | 246 // shorter lifetime. |
248 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; | 247 nacl::scoped_ptr<PnaclTranslateThread> translate_thread_; |
249 }; | 248 }; |
250 | 249 |
251 //---------------------------------------------------------------------- | 250 //---------------------------------------------------------------------- |
252 | 251 |
253 } // namespace plugin; | 252 } // namespace plugin; |
254 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ | 253 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ |
OLD | NEW |