| 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/pp_file_handle.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/nexe_arch.h" | |
| 19 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" | 18 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" |
| 20 | 19 |
| 21 namespace plugin { | 20 namespace plugin { |
| 22 | 21 |
| 23 class Manifest; | 22 class Manifest; |
| 24 class Plugin; | 23 class Plugin; |
| 25 class PnaclCoordinator; | 24 class PnaclCoordinator; |
| 26 | 25 |
| 27 // Constants for loading LLC and LD. | 26 // Constants for loading LLC and LD. |
| 28 class PnaclUrls { | 27 class PnaclUrls { |
| 29 public: | 28 public: |
| 30 // Get the base URL prefix for Pnacl resources (without platform prefix). | 29 // Get the base URL prefix for Pnacl resources (without platform prefix). |
| 31 static nacl::string GetBaseUrl(); | 30 static nacl::string GetBaseUrl(); |
| 32 | 31 |
| 33 // Return {platform_prefix}/url | |
| 34 static nacl::string PrependPlatformPrefix(const nacl::string& url); | |
| 35 | |
| 36 static bool IsPnaclComponent(const nacl::string& full_url); | 32 static bool IsPnaclComponent(const nacl::string& full_url); |
| 37 static nacl::string PnaclComponentURLToFilename( | 33 static nacl::string PnaclComponentURLToFilename( |
| 38 const nacl::string& full_url); | 34 const nacl::string& full_url); |
| 39 | 35 |
| 40 // Get the URL for the resource info JSON file that contains information | 36 // Get the URL for the resource info JSON file that contains information |
| 41 // about loadable resources. | 37 // about loadable resources. |
| 42 static const nacl::string GetResourceInfoUrl() { | 38 static const nacl::string GetResourceInfoUrl() { |
| 43 return nacl::string(kResourceInfoUrl); | 39 return nacl::string(kResourceInfoUrl); |
| 44 } | 40 } |
| 45 private: | 41 private: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 71 const pp::CompletionCallback& all_loaded_callback); | 67 const pp::CompletionCallback& all_loaded_callback); |
| 72 | 68 |
| 73 const nacl::string& GetLlcUrl() { | 69 const nacl::string& GetLlcUrl() { |
| 74 return llc_tool_name; | 70 return llc_tool_name; |
| 75 } | 71 } |
| 76 | 72 |
| 77 const nacl::string& GetLdUrl() { | 73 const nacl::string& GetLdUrl() { |
| 78 return ld_tool_name; | 74 return ld_tool_name; |
| 79 } | 75 } |
| 80 | 76 |
| 81 nacl::string GetFullUrl(const nacl::string& partial_url) const; | 77 nacl::string GetFullUrl(const nacl::string& partial_url, |
| 78 const nacl::string& sandbox_arch) const; |
| 82 | 79 |
| 83 // Get file descs by name. Only valid after StartLoad's completion callback | 80 // Get file descs by name. Only valid after StartLoad's completion callback |
| 84 // fired. | 81 // fired. |
| 85 nacl::DescWrapper* WrapperForUrl(const nacl::string& url); | 82 nacl::DescWrapper* WrapperForUrl(const nacl::string& url); |
| 86 | 83 |
| 87 static int32_t GetPnaclFD(Plugin* plugin, const char* filename); | 84 static int32_t GetPnaclFD(Plugin* plugin, const char* filename); |
| 88 | 85 |
| 89 private: | 86 private: |
| 90 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources); | 87 NACL_DISALLOW_COPY_AND_ASSIGN(PnaclResources); |
| 91 | 88 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 107 // Otherwise returns false and places an error message in |errmsg|. | 104 // Otherwise returns false and places an error message in |errmsg|. |
| 108 bool ParseResourceInfo(const nacl::string& buf, nacl::string& errmsg); | 105 bool ParseResourceInfo(const nacl::string& buf, nacl::string& errmsg); |
| 109 | 106 |
| 110 // Convenience function for reporting an error while reading the resource | 107 // Convenience function for reporting an error while reading the resource |
| 111 // info file. | 108 // info file. |
| 112 void ReadResourceInfoError(const nacl::string& msg); | 109 void ReadResourceInfoError(const nacl::string& msg); |
| 113 }; | 110 }; |
| 114 | 111 |
| 115 } // namespace plugin; | 112 } // namespace plugin; |
| 116 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ | 113 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ |
| OLD | NEW |