diff options
author | jvoung <jvoung@chromium.org> | 2014-10-02 21:39:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-03 04:39:52 +0000 |
commit | 203dbe474745b94c447c0e1dfc18cfae409a2840 (patch) | |
tree | dbab4650751f131dd515e1ce275008ec3198391a /ppapi/native_client | |
parent | a03ae49d253d7d1f517e2f92146a6ba201c78aa6 (diff) | |
download | chromium_src-203dbe474745b94c447c0e1dfc18cfae409a2840.zip chromium_src-203dbe474745b94c447c0e1dfc18cfae409a2840.tar.gz chromium_src-203dbe474745b94c447c0e1dfc18cfae409a2840.tar.bz2 |
NaCl: Replace launch/start param flags with a NaClAppProcessType enum.
There was already an enum called NaClProcessType (for the
broker, etc.), so I called this NaClAppProcessType instead.
Renamed the original NaClProcessType to NaClTrustedProcessType.
This type can then be used to decide on various things
like crash throttling, nexe size limits, dyncode
enablement, IRT usage rather than plumb separate flags
through the various layers and IPCs. Then we can tweak
the "uses_irt" to be "optional" for the PNaClTranslator
as well.
Misc: removed enable_dev_interfaces from service_runtime
SelLdrStartParams struct, since it looked unused.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3914
Review URL: https://codereview.chromium.org/614373004
Cr-Commit-Position: refs/heads/master@{#297987}
Diffstat (limited to 'ppapi/native_client')
5 files changed, 13 insertions, 46 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index b74df3e..518751c 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -118,9 +118,7 @@ void Plugin::SignalStartSelLdrDone(int32_t pp_error, void Plugin::LoadNaClModule(PP_NaClFileInfo file_info, bool uses_nonsfi_mode, - bool enable_dyncode_syscalls, - bool enable_exception_handling, - bool enable_crash_throttling, + PP_NaClAppProcessType process_type, const pp::CompletionCallback& init_done_cb) { CHECK(pp::Module::Get()->core()->IsMainThread()); // Before forking a new sel_ldr process, ensure that we do not leak @@ -134,11 +132,7 @@ void Plugin::LoadNaClModule(PP_NaClFileInfo file_info, SelLdrStartParams params(manifest_base_url_str, file_info, - true /* uses_irt */, - true /* uses_ppapi */, - enable_dyncode_syscalls, - enable_exception_handling, - enable_crash_throttling); + process_type); ErrorInfo error_info; ServiceRuntime* service_runtime = new ServiceRuntime( this, pp_instance(), true, uses_nonsfi_mode, init_done_cb); @@ -203,11 +197,7 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(const std::string& helper_url, // done to save on address space and swap space. SelLdrStartParams params(helper_url, file_info, - false /* uses_irt */, - false /* uses_ppapi */, - false /* enable_dyncode_syscalls */, - false /* enable_exception_handling */, - true /* enable_crash_throttling */); + PP_PNACL_TRANSLATOR_PROCESS_TYPE); // Helper NaCl modules always use the PNaCl manifest, as there is no // corresponding NMF. @@ -324,9 +314,7 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { LoadNaClModule( nexe_file_info_, uses_nonsfi_mode_, - true, /* enable_dyncode_syscalls */ - true, /* enable_exception_handling */ - false, /* enable_crash_throttling */ + PP_NATIVE_NACL_PROCESS_TYPE, callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation)); } @@ -363,9 +351,7 @@ void Plugin::BitcodeDidTranslate(int32_t pp_error) { LoadNaClModule( info, false, /* uses_nonsfi_mode */ - false, /* enable_dyncode_syscalls */ - false, /* enable_exception_handling */ - true, /* enable_crash_throttling */ + PP_PNACL_PROCESS_TYPE, callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation)); } diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index d71e589..1fe082a 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -85,9 +85,7 @@ class Plugin : public pp::Instance { // mechanism(s) take over. void LoadNaClModule(PP_NaClFileInfo file_info, bool uses_nonsfi_mode, - bool enable_dyncode_syscalls, - bool enable_exception_handling, - bool enable_crash_throttling, + PP_NaClAppProcessType process_type, const pp::CompletionCallback& init_done_cb); // Finish hooking interfaces up, after low-level initialization is diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc index 3473ffe..c949907 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc @@ -396,13 +396,9 @@ void ServiceRuntime::StartSelLdr(const SelLdrStartParams& params, PP_FromBool(main_service_runtime_), params.url.c_str(), ¶ms.file_info, - PP_FromBool(params.uses_irt), - PP_FromBool(params.uses_ppapi), PP_FromBool(uses_nonsfi_mode_), PP_FromBool(enable_dev_interfaces), - PP_FromBool(params.enable_dyncode_syscalls), - PP_FromBool(params.enable_exception_handling), - PP_FromBool(params.enable_crash_throttling), + params.process_type, &bootstrap_channel_, callback.pp_completion_callback()); subprocess_.reset(tmp_subprocess.release()); diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h index 5429bd2..a934101 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.h +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h @@ -36,27 +36,14 @@ class ServiceRuntime; struct SelLdrStartParams { SelLdrStartParams(const std::string& url, const PP_NaClFileInfo& file_info, - bool uses_irt, - bool uses_ppapi, - bool enable_dyncode_syscalls, - bool enable_exception_handling, - bool enable_crash_throttling) + PP_NaClAppProcessType process_type) : url(url), file_info(file_info), - uses_irt(uses_irt), - uses_ppapi(uses_ppapi), - enable_dyncode_syscalls(enable_dyncode_syscalls), - enable_exception_handling(enable_exception_handling), - enable_crash_throttling(enable_crash_throttling) { + process_type(process_type) { } std::string url; PP_NaClFileInfo file_info; - bool uses_irt; - bool uses_ppapi; - bool enable_dev_interfaces; - bool enable_dyncode_syscalls; - bool enable_exception_handling; - bool enable_crash_throttling; + PP_NaClAppProcessType process_type; }; // Callback resources are essentially our continuation state. 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 ee1219b..7dc3874 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 @@ -3455,9 +3455,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_irt, PP_Bool uses_ppapi, PP_Bool uses_nonsfi_mode, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, 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_Bool enable_ppapi_dev, 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_irt, uses_ppapi, uses_nonsfi_mode, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, enable_crash_throttling, imc_handle, *callback); + iface->LaunchSelLdr(instance, main_service_runtime, alleged_url, nexe_file_info, uses_nonsfi_mode, enable_ppapi_dev, process_type, imc_handle, *callback); } static PP_Bool Pnacl_M25_PPB_NaCl_Private_StartPpapiProxy(PP_Instance instance) { @@ -5464,7 +5464,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_irt, PP_Bool uses_ppapi, PP_Bool uses_nonsfi_mode, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, 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_Bool enable_ppapi_dev, PP_NaClAppProcessType process_type, void* imc_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr, .StartPpapiProxy = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_StartPpapiProxy, .UrandomFD = (int32_t (*)(void))&Pnacl_M25_PPB_NaCl_Private_UrandomFD, .Are3DInterfacesDisabled = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_Are3DInterfacesDisabled, |