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