Commit b32761dc authored by teravest@chromium.org's avatar teravest@chromium.org

Pepper: Small PnaclResources cleanup

This fixes a place where the wrong URL is used for the ld process when
performing PNaCl translation. I don't believe the effect of this is severe,
though it will cause the wrong url to be displayed when it's running.

This also removes an unnecessary string constant usage in the trusted plugin.

BUG=

Review URL: https://codereview.chromium.org/373003005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282176 0039d316-1c4b-4281-b951-d872f2087c98
parent fede7212
......@@ -1126,9 +1126,9 @@ bool ManifestResolveKey(PP_Instance instance,
}
PP_Bool GetPNaClResourceInfo(PP_Instance instance,
const char* filename,
PP_Var* llc_tool_name,
PP_Var* ld_tool_name) {
static const char kFilename[] = "chrome://pnacl-translator/pnacl.json";
NexeLoadManager* load_manager = GetNexeLoadManager(instance);
DCHECK(load_manager);
if (!load_manager)
......@@ -1136,7 +1136,7 @@ PP_Bool GetPNaClResourceInfo(PP_Instance instance,
uint64_t nonce_lo = 0;
uint64_t nonce_hi = 0;
base::File file(GetReadonlyPnaclFd(filename, false /* is_executable */,
base::File file(GetReadonlyPnaclFd(kFilename, false /* is_executable */,
&nonce_lo, &nonce_hi));
if (!file.IsValid()) {
load_manager->ReportLoadError(
......@@ -1152,14 +1152,14 @@ PP_Bool GetPNaClResourceInfo(PP_Instance instance,
load_manager->ReportLoadError(
PP_NACL_ERROR_PNACL_RESOURCE_FETCH,
std::string("GetPNaClResourceInfo, GetFileInfo failed for: ") +
filename);
kFilename);
return PP_FALSE;
}
if (file_info.size > 1 << 20) {
load_manager->ReportLoadError(
PP_NACL_ERROR_PNACL_RESOURCE_FETCH,
std::string("GetPNaClResourceInfo, file too large: ") + filename);
std::string("GetPNaClResourceInfo, file too large: ") + kFilename);
return PP_FALSE;
}
......@@ -1168,7 +1168,7 @@ PP_Bool GetPNaClResourceInfo(PP_Instance instance,
load_manager->ReportLoadError(
PP_NACL_ERROR_PNACL_RESOURCE_FETCH,
std::string("GetPNaClResourceInfo, couldn't allocate for: ") +
filename);
kFilename);
return PP_FALSE;
}
......@@ -1176,7 +1176,7 @@ PP_Bool GetPNaClResourceInfo(PP_Instance instance,
if (rc < 0) {
load_manager->ReportLoadError(
PP_NACL_ERROR_PNACL_RESOURCE_FETCH,
std::string("GetPNaClResourceInfo, reading failed for: ") + filename);
std::string("GetPNaClResourceInfo, reading failed for: ") + kFilename);
return PP_FALSE;
}
......
......@@ -363,11 +363,8 @@ interface PPB_NaCl_Private {
[out] PP_PNaClOptions pnacl_options,
[out] PP_Bool uses_nonsfi_mode);
/* Returns the filenames for the llc and ld tools, parsing that information
* from the file given in |filename|.
*/
/* Returns the filenames for the llc and ld tools. */
PP_Bool GetPnaclResourceInfo([in] PP_Instance instance,
[in] str_t filename,
[out] PP_Var llc_tool_name,
[out] PP_Var ld_tool_name);
......
......@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
/* From private/ppb_nacl_private.idl modified Wed Jul 2 12:11:51 2014. */
/* From private/ppb_nacl_private.idl modified Wed Jul 9 11:09:04 2014. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
......@@ -369,11 +369,8 @@ struct PPB_NaCl_Private_1_0 {
struct PP_Var* full_url,
struct PP_PNaClOptions* pnacl_options,
PP_Bool* uses_nonsfi_mode);
/* Returns the filenames for the llc and ld tools, parsing that information
* from the file given in |filename|.
*/
/* Returns the filenames for the llc and ld tools. */
PP_Bool (*GetPnaclResourceInfo)(PP_Instance instance,
const char* filename,
struct PP_Var* llc_tool_name,
struct PP_Var* ld_tool_name);
/* PP_Var string of attributes describing the CPU features supported
......
......@@ -42,7 +42,6 @@ bool PnaclResources::ReadResourceInfo() {
PP_Var pp_ld_tool_name_var;
if (!plugin_->nacl_interface()->GetPnaclResourceInfo(
plugin_->pp_instance(),
"chrome://pnacl-translator/pnacl.json",
&pp_llc_tool_name_var,
&pp_ld_tool_name_var)) {
return false;
......
......@@ -59,5 +59,5 @@ class PnaclResources {
PP_NaClFileInfo ld_file_info_;
};
} // namespace plugin;
} // namespace plugin
#endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_
......@@ -337,7 +337,7 @@ bool PnaclTranslateThread::RunLdSubprocess() {
PP_NaClFileInfo ld_file_info = resources_->TakeLdFileInfo();
// On success, ownership of ld_file_info is transferred.
nacl::scoped_ptr<NaClSubprocess> ld_subprocess(
plugin_->LoadHelperNaClModule(resources_->GetLlcUrl(),
plugin_->LoadHelperNaClModule(resources_->GetLdUrl(),
ld_file_info,
&error_info));
if (ld_subprocess.get() == NULL) {
......
......@@ -3437,9 +3437,9 @@ static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetManifestProgramURL(PP_Instance inst
return iface->GetManifestProgramURL(instance, full_url, pnacl_options, uses_nonsfi_mode);
}
static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetPnaclResourceInfo(PP_Instance instance, const char* filename, struct PP_Var* llc_tool_name, struct PP_Var* ld_tool_name) {
static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetPnaclResourceInfo(PP_Instance instance, struct PP_Var* llc_tool_name, struct PP_Var* ld_tool_name) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
return iface->GetPnaclResourceInfo(instance, filename, llc_tool_name, ld_tool_name);
return iface->GetPnaclResourceInfo(instance, llc_tool_name, ld_tool_name);
}
static void Pnacl_M25_PPB_NaCl_Private_GetCpuFeatureAttrs(struct PP_Var* _struct_result) {
......@@ -5251,7 +5251,7 @@ static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
.ProcessNaClManifest = (void (*)(PP_Instance instance, const char* program_url))&Pnacl_M25_PPB_NaCl_Private_ProcessNaClManifest,
.DevInterfacesEnabled = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_DevInterfacesEnabled,
.GetManifestProgramURL = (PP_Bool (*)(PP_Instance instance, struct PP_Var* full_url, struct PP_PNaClOptions* pnacl_options, PP_Bool* uses_nonsfi_mode))&Pnacl_M25_PPB_NaCl_Private_GetManifestProgramURL,
.GetPnaclResourceInfo = (PP_Bool (*)(PP_Instance instance, const char* filename, struct PP_Var* llc_tool_name, struct PP_Var* ld_tool_name))&Pnacl_M25_PPB_NaCl_Private_GetPnaclResourceInfo,
.GetPnaclResourceInfo = (PP_Bool (*)(PP_Instance instance, struct PP_Var* llc_tool_name, struct PP_Var* ld_tool_name))&Pnacl_M25_PPB_NaCl_Private_GetPnaclResourceInfo,
.GetCpuFeatureAttrs = (struct PP_Var (*)(void))&Pnacl_M25_PPB_NaCl_Private_GetCpuFeatureAttrs,
.PostMessageToJavaScript = (void (*)(PP_Instance instance, const char* message))&Pnacl_M25_PPB_NaCl_Private_PostMessageToJavaScript,
.DownloadNexe = (void (*)(PP_Instance instance, const char* url, struct PP_NaClFileInfo* file_info, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_DownloadNexe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment