summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormseaborn <mseaborn@chromium.org>2015-01-23 22:19:30 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-24 06:20:21 +0000
commit70e58ead2e061d1044b10a3781f9c21d3ed10e0c (patch)
treeeb62fb74609a45aedbaacc0154cca91398c610e3
parent61bf2ae6b70c0395bb9309ba4c187b9eeee32bc0 (diff)
downloadchromium_src-70e58ead2e061d1044b10a3781f9c21d3ed10e0c.zip
chromium_src-70e58ead2e061d1044b10a3781f9c21d3ed10e0c.tar.gz
chromium_src-70e58ead2e061d1044b10a3781f9c21d3ed10e0c.tar.bz2
NaCl: Simplify the plumbing for PPAPI's DevInterfacesEnabled flag
There's no need for this flag to be sent from ppb_nacl_private_impl.cc to plugin.cc and back again. It can stay within ppb_nacl_private_impl.cc. This merges two error-handling checks in LaunchSelLdr(). BUG=239656 TEST=browser_tests Review URL: https://codereview.chromium.org/874603002 Cr-Commit-Position: refs/heads/master@{#313010}
-rw-r--r--components/nacl/renderer/ppb_nacl_private_impl.cc22
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl6
-rw-r--r--ppapi/c/private/ppb_nacl_private.h7
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc4
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c12
5 files changed, 10 insertions, 41 deletions
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index c9eca51..3c84afe 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -358,7 +358,6 @@ void LaunchSelLdr(PP_Instance instance,
const char* alleged_url,
const PP_NaClFileInfo* nexe_file_info,
PP_Bool uses_nonsfi_mode,
- PP_Bool enable_ppapi_dev,
PP_NaClAppProcessType pp_process_type,
void* imc_handle,
PP_CompletionCallback callback) {
@@ -374,7 +373,9 @@ void LaunchSelLdr(PP_Instance instance,
IPC::Sender* sender = content::RenderThread::Get();
DCHECK(sender);
int routing_id = GetRoutingID(instance);
- if (!routing_id) {
+ NexeLoadManager* load_manager = GetNexeLoadManager(instance);
+ DCHECK(load_manager);
+ if (!routing_id || !load_manager) {
if (nexe_file_info->handle != PP_kInvalidFileHandle) {
base::File closer(nexe_file_info->handle);
}
@@ -391,7 +392,7 @@ void LaunchSelLdr(PP_Instance instance,
// Conditionally block 'Dev' interfaces. We do this for the NaCl process, so
// it's clearer to developers when they are using 'Dev' inappropriately. We
// must also check on the trusted side of the proxy.
- if (enable_ppapi_dev)
+ if (load_manager->DevInterfacesEnabled())
perm_bits |= ppapi::PERMISSION_DEV;
instance_info.permissions =
ppapi::PpapiPermissions::GetForCommandLine(perm_bits);
@@ -430,13 +431,6 @@ void LaunchSelLdr(PP_Instance instance,
return;
}
- NexeLoadManager* load_manager = GetNexeLoadManager(instance);
- DCHECK(load_manager);
- if (!load_manager) {
- PostPPCompletionCallback(callback, PP_ERROR_FAILED);
- base::SharedMemory::CloseHandle(launch_result.crash_info_shmem_handle);
- return;
- }
load_manager->set_nonsfi(PP_ToBool(uses_nonsfi_mode));
if (!error_message_string.empty()) {
@@ -903,13 +897,6 @@ void ProcessNaClManifest(PP_Instance instance, const char* program_url) {
load_manager->ProcessNaClManifest(program_url);
}
-PP_Bool DevInterfacesEnabled(PP_Instance instance) {
- nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
- if (load_manager)
- return PP_FromBool(load_manager->DevInterfacesEnabled());
- return PP_FALSE;
-}
-
void DownloadManifestToBufferCompletion(PP_Instance instance,
struct PP_CompletionCallback callback,
base::Time start_time,
@@ -1654,7 +1641,6 @@ const PPB_NaCl_Private nacl_interface = {
&RequestNaClManifest,
&GetManifestBaseURL,
&ProcessNaClManifest,
- &DevInterfacesEnabled,
&ManifestGetProgramURL,
&GetPNaClResourceInfo,
&GetCpuFeatureAttrs,
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index 0307fc1..37c1155 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -168,8 +168,7 @@ struct PP_NaClFileInfo {
interface PPB_NaCl_Private {
/* Launches NaCl's sel_ldr process. Returns PP_EXTERNAL_PLUGIN_OK on success
* and writes a NaClHandle to imc_handle. Returns PP_EXTERNAL_PLUGIN_FAILED on
- * failure. The |enable_ppapi_dev| parameter controls whether GetInterface
- * returns 'Dev' interfaces to the NaCl plugin.
+ * failure.
* The |nexe_file_info| is currently used only in non-SFI mode. It is the
* file handle for the main nexe file, which should be initially loaded.
* LaunchSelLdr takes the ownership of the file handle.
@@ -181,7 +180,6 @@ interface PPB_NaCl_Private {
[in] str_t alleged_url,
[in] PP_NaClFileInfo nexe_file_info,
[in] PP_Bool uses_nonsfi_mode,
- [in] PP_Bool enable_ppapi_dev,
[in] PP_NaClAppProcessType process_type,
[out] mem_t imc_handle,
[in] PP_CompletionCallback callback);
@@ -281,8 +279,6 @@ interface PPB_NaCl_Private {
void ProcessNaClManifest([in] PP_Instance instance,
[in] str_t program_url);
- PP_Bool DevInterfacesEnabled([in] PP_Instance instance);
-
PP_Bool GetManifestProgramURL([in] PP_Instance instance,
[out] PP_Var full_url,
[out] PP_PNaClOptions pnacl_options,
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index b2cab06..e80e35e 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Fri Jan 23 07:36:29 2015. */
+/* From private/ppb_nacl_private.idl modified Fri Jan 23 09:09:44 2015. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -211,8 +211,7 @@ struct PP_NaClFileInfo {
struct PPB_NaCl_Private_1_0 {
/* Launches NaCl's sel_ldr process. Returns PP_EXTERNAL_PLUGIN_OK on success
* and writes a NaClHandle to imc_handle. Returns PP_EXTERNAL_PLUGIN_FAILED on
- * failure. The |enable_ppapi_dev| parameter controls whether GetInterface
- * returns 'Dev' interfaces to the NaCl plugin.
+ * failure.
* The |nexe_file_info| is currently used only in non-SFI mode. It is the
* file handle for the main nexe file, which should be initially loaded.
* LaunchSelLdr takes the ownership of the file handle.
@@ -224,7 +223,6 @@ struct PPB_NaCl_Private_1_0 {
const char* alleged_url,
const struct PP_NaClFileInfo* nexe_file_info,
PP_Bool uses_nonsfi_mode,
- PP_Bool enable_ppapi_dev,
PP_NaClAppProcessType process_type,
void* imc_handle,
struct PP_CompletionCallback callback);
@@ -306,7 +304,6 @@ struct PPB_NaCl_Private_1_0 {
* plugin.
*/
void (*ProcessNaClManifest)(PP_Instance instance, const char* program_url);
- PP_Bool (*DevInterfacesEnabled)(PP_Instance instance);
PP_Bool (*GetManifestProgramURL)(PP_Instance instance,
struct PP_Var* full_url,
struct PP_PNaClOptions* pnacl_options,
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index a62272c..e58efd04 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -144,16 +144,12 @@ void ServiceRuntime::StartSelLdr(const SelLdrStartParams& params,
return;
}
- bool enable_dev_interfaces =
- GetNaClInterface()->DevInterfacesEnabled(pp_instance_);
-
GetNaClInterface()->LaunchSelLdr(
pp_instance_,
PP_FromBool(main_service_runtime_),
params.url.c_str(),
&params.file_info,
PP_FromBool(uses_nonsfi_mode_),
- PP_FromBool(enable_dev_interfaces),
params.process_type,
&bootstrap_channel_,
callback.pp_completion_callback());
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index 5b7daf2..6d42f33 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -3600,9 +3600,9 @@ static int32_t Pnacl_M33_PPB_IsolatedFileSystem_Private_Open(PP_Instance instanc
/* Begin wrapper methods for PPB_NaCl_Private_1_0 */
-static void Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, PP_Bool main_service_runtime, const char* alleged_url, const struct PP_NaClFileInfo* nexe_file_info, PP_Bool uses_nonsfi_mode, PP_Bool enable_ppapi_dev, PP_NaClAppProcessType process_type, void* imc_handle, struct PP_CompletionCallback* callback) {
+static void Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, PP_Bool main_service_runtime, const char* alleged_url, const struct PP_NaClFileInfo* nexe_file_info, PP_Bool uses_nonsfi_mode, PP_NaClAppProcessType process_type, void* imc_handle, struct PP_CompletionCallback* callback) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- iface->LaunchSelLdr(instance, main_service_runtime, alleged_url, nexe_file_info, uses_nonsfi_mode, enable_ppapi_dev, process_type, imc_handle, *callback);
+ iface->LaunchSelLdr(instance, main_service_runtime, alleged_url, nexe_file_info, uses_nonsfi_mode, process_type, imc_handle, *callback);
}
static int32_t Pnacl_M25_PPB_NaCl_Private_UrandomFD(void) {
@@ -3685,11 +3685,6 @@ static void Pnacl_M25_PPB_NaCl_Private_ProcessNaClManifest(PP_Instance instance,
iface->ProcessNaClManifest(instance, program_url);
}
-static PP_Bool Pnacl_M25_PPB_NaCl_Private_DevInterfacesEnabled(PP_Instance instance) {
- const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- return iface->DevInterfacesEnabled(instance);
-}
-
static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetManifestProgramURL(PP_Instance instance, struct PP_Var* full_url, struct PP_PNaClOptions* pnacl_options, PP_Bool* uses_nonsfi_mode) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
return iface->GetManifestProgramURL(instance, full_url, pnacl_options, uses_nonsfi_mode);
@@ -5587,7 +5582,7 @@ static const struct PPB_IsolatedFileSystem_Private_0_2 Pnacl_Wrappers_PPB_Isolat
};
static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
- .LaunchSelLdr = (void (*)(PP_Instance instance, PP_Bool main_service_runtime, const char* alleged_url, const struct PP_NaClFileInfo* nexe_file_info, PP_Bool uses_nonsfi_mode, PP_Bool enable_ppapi_dev, PP_NaClAppProcessType process_type, void* imc_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr,
+ .LaunchSelLdr = (void (*)(PP_Instance instance, PP_Bool main_service_runtime, const char* alleged_url, const struct PP_NaClFileInfo* nexe_file_info, PP_Bool uses_nonsfi_mode, PP_NaClAppProcessType process_type, void* imc_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr,
.UrandomFD = (int32_t (*)(void))&Pnacl_M25_PPB_NaCl_Private_UrandomFD,
.BrokerDuplicateHandle = (int32_t (*)(PP_FileHandle source_handle, uint32_t process_id, PP_FileHandle* target_handle, uint32_t desired_access, uint32_t options))&Pnacl_M25_PPB_NaCl_Private_BrokerDuplicateHandle,
.GetReadExecPnaclFd = (void (*)(const char* url, struct PP_NaClFileInfo* out_file_info))&Pnacl_M25_PPB_NaCl_Private_GetReadExecPnaclFd,
@@ -5604,7 +5599,6 @@ static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
.RequestNaClManifest = (void (*)(PP_Instance instance, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_RequestNaClManifest,
.GetManifestBaseURL = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetManifestBaseURL,
.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, 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,