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_RESOURCES_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ |
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
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_string.h" | 12 #include "native_client/src/include/nacl_string.h" |
13 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 13 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
14 | 14 |
15 #include "ppapi/c/private/pp_file_handle.h" | 15 #include "ppapi/c/private/ppb_nacl_private.h" |
16 #include "ppapi/cpp/completion_callback.h" | 16 #include "ppapi/cpp/completion_callback.h" |
17 | 17 |
18 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" | 18 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" |
19 | 19 |
20 namespace plugin { | 20 namespace plugin { |
21 | 21 |
22 class Plugin; | 22 class Plugin; |
23 | 23 |
24 // Loads a list of resources, providing a way to get file descriptors for | 24 // Loads a list of resources, providing a way to get file descriptors for |
25 // these resources. URLs for resources are resolved by the manifest | 25 // these resources. URLs for resources are resolved by the manifest |
26 // and point to pnacl component filesystem resources. | 26 // and point to pnacl component filesystem resources. |
27 class PnaclResources { | 27 class PnaclResources { |
28 public: | 28 public: |
29 explicit PnaclResources(Plugin* plugin) | 29 explicit PnaclResources(Plugin* plugin); |
30 : plugin_(plugin), | |
31 llc_file_handle_(PP_kInvalidFileHandle), | |
32 ld_file_handle_(PP_kInvalidFileHandle) { | |
33 } | |
34 virtual ~PnaclResources(); | 30 virtual ~PnaclResources(); |
35 | 31 |
36 // Read the resource info JSON file. This is the first step after | 32 // Read the resource info JSON file. This is the first step after |
37 // construction; it has to be completed before StartLoad is called. | 33 // construction; it has to be completed before StartLoad is called. |
38 bool ReadResourceInfo(); | 34 bool ReadResourceInfo(); |
39 | 35 |
40 // Start loading the resources. | 36 // Start loading the resources. |
41 bool StartLoad(); | 37 bool StartLoad(); |
42 | 38 |
43 const nacl::string& GetLlcUrl() { return llc_tool_name_; } | 39 const nacl::string& GetLlcUrl() { return llc_tool_name_; } |
44 const nacl::string& GetLdUrl() { return ld_tool_name_; } | 40 const nacl::string& GetLdUrl() { return ld_tool_name_; } |
45 | 41 |
46 PP_FileHandle TakeLlcFileHandle(); | 42 PP_NaClFileInfo TakeLlcFileInfo(); |
47 PP_FileHandle TakeLdFileHandle(); | 43 PP_NaClFileInfo TakeLdFileInfo(); |
48 | 44 |
49 private: | 45 private: |
50 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources); | 46 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources); |
51 | 47 |
52 // The plugin requesting the resource loading. | 48 // The plugin requesting the resource loading. |
53 Plugin* plugin_; | 49 Plugin* plugin_; |
54 | 50 |
55 // Tool names for llc and ld; read from the resource info file. | 51 // Tool names for llc and ld; read from the resource info file. |
56 nacl::string llc_tool_name_; | 52 nacl::string llc_tool_name_; |
57 nacl::string ld_tool_name_; | 53 nacl::string ld_tool_name_; |
58 | 54 |
59 // File handles for llc and ld executables, after they've been opened. | 55 // File handles / info for llc and ld executables, after they've been opened. |
teravest
2014/06/26 21:19:24
you can drop the "handles /" here.
jvoung (off chromium)
2014/06/26 22:48:39
Done.
| |
60 // Only valid after the callback for StartLoad() has been called, and until | 56 // Only valid after the callback for StartLoad() has been called, and until |
61 // TakeLlcFileHandle()/TakeLdFileHandle() is called. | 57 // TakeLlcFileHandle()/TakeLdFileHandle() is called. |
62 PP_FileHandle llc_file_handle_; | 58 PP_NaClFileInfo llc_file_info_; |
63 PP_FileHandle ld_file_handle_; | 59 PP_NaClFileInfo ld_file_info_; |
64 }; | 60 }; |
65 | 61 |
66 } // namespace plugin; | 62 } // namespace plugin; |
67 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ | 63 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ |
OLD | NEW |