Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Unified Diff: ppapi/native_client/src/trusted/plugin/pnacl_resources.cc

Issue 193313002: Pepper: Move GetSandboxISA() to PPB_NaCl_Private. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nacl_interface threading fix Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
index 6ed851302487d2f959c15d1e982d2624793ec78f..d2b35086d23ba208b0bcfdbafdc8751b952e8a29 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
@@ -17,6 +17,14 @@
#include "third_party/jsoncpp/source/include/json/value.h"
namespace plugin {
+namespace {
+const PPB_NaCl_Private* GetNaClInterface() {
+ pp::Module *module = pp::Module::Get();
+ CHECK(module);
+ return static_cast<const PPB_NaCl_Private*>(
+ module->GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE));
+}
+} // namespace
static const char kPnaclBaseUrl[] = "chrome://pnacl-translator/";
const char PnaclUrls::kResourceInfoUrl[] = "pnacl.json";
@@ -25,10 +33,6 @@ nacl::string PnaclUrls::GetBaseUrl() {
return nacl::string(kPnaclBaseUrl);
}
-nacl::string PnaclUrls::PrependPlatformPrefix(const nacl::string& url) {
- return nacl::string(GetSandboxISA()) + "/" + url;
-}
-
// Determine if a URL is for a pnacl-component file, or if it is some other
// type of URL (e.g., http://, https://, chrome-extension://).
// The URL could be one of the other variants for shared libraries
@@ -188,12 +192,14 @@ bool PnaclResources::ParseResourceInfo(const nacl::string& buf,
return true;
}
-nacl::string PnaclResources::GetFullUrl(const nacl::string& partial_url) const {
+nacl::string PnaclResources::GetFullUrl(
+ const nacl::string& partial_url, const nacl::string& sandbox_arch) const {
nacl::string full_url;
ErrorInfo error_info;
const nacl::string& url_with_platform_prefix =
- PnaclUrls::PrependPlatformPrefix(partial_url);
- if (!manifest_->ResolveURL(url_with_platform_prefix, &full_url,
+ sandbox_arch + "/" + partial_url;
+ if (!manifest_->ResolveURL(url_with_platform_prefix,
+ &full_url,
&error_info)) {
PLUGIN_PRINTF(("PnaclResources::GetFullUrl failed: %s.\n",
error_info.message().c_str()));
@@ -214,7 +220,8 @@ void PnaclResources::StartLoad(
// Do a blocking load of each of the resources.
int32_t result = PP_OK;
for (size_t i = 0; i < resource_urls.size(); ++i) {
- nacl::string full_url = GetFullUrl(resource_urls[i]);
+ nacl::string full_url = GetFullUrl(
+ resource_urls[i], plugin_->nacl_interface()->GetSandboxArch());
if (full_url == "") {
coordinator_->ReportNonPpapiError(
PP_NACL_ERROR_PNACL_RESOURCE_FETCH,

Powered by Google App Engine
This is Rietveld 408576698