diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-15 22:30:20 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-15 22:30:20 +0000 |
commit | ade946b0f3caa36e82ce2bf0a58da556c0b329c7 (patch) | |
tree | a1b74335b243bce1d712204643fec65d95c003cc /ppapi | |
parent | f6257e3f6b5ef909bb35b8e410d6f6a0b04295d1 (diff) | |
download | chromium_src-ade946b0f3caa36e82ce2bf0a58da556c0b329c7.zip chromium_src-ade946b0f3caa36e82ce2bf0a58da556c0b329c7.tar.gz chromium_src-ade946b0f3caa36e82ce2bf0a58da556c0b329c7.tar.bz2 |
Add an instance parameter to PPB_NaCl_Private::LaunchSelLdr.
BUG=116317
TEST=compiles
Review URL: https://chromiumcodereview.appspot.com/10343005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137272 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
6 files changed, 48 insertions, 20 deletions
diff --git a/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl b/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl index 20e8833..e9047d2 100644 --- a/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl +++ b/ppapi/api/private/finish_writing_these/ppb_nacl_private.idl @@ -6,20 +6,20 @@ /* This file contains NaCl private interfaces. */ /* PPB_NaCl_Private */ -interface PPB_NaCl_Private_0_2 { +interface PPB_NaCl_Private_0_5 { /* This function launches NaCl's sel_ldr process. On success, the function * returns true, otherwise it returns false. When it returns true, it will - * write |socket_count| nacl::Handles to imc_handles and will write the - * nacl::Handle of the created process to |nacl_process_handle|. Finally, - * the function will write the process ID of the created process to - * |nacl_process_id|. + * write |socket_count| nacl::Handles to imc_handles. */ - bool LaunchSelLdr( - [in] str_t alleged_url, - [in] int32_t socket_count, - [out] mem_t imc_handles, - [out] mem_t nacl_process_handle, - [out] int32_t nacl_process_id); + bool LaunchSelLdr([in] PP_Instance instance, + [in] str_t alleged_url, + [in] int32_t socket_count, + [out] mem_t imc_handles); + + /* This function starts the PPAPI proxy so the nexe can communicate with the + * browser's renderer process. + */ + bool StartPpapiProxy([in] PP_Instance instance); /* On POSIX systems, this function returns the file descriptor of * /dev/urandom. On non-POSIX systems, this function returns 0. diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h index 1dcc9ee..dc7e7a2 100644 --- a/ppapi/c/private/ppb_nacl_private.h +++ b/ppapi/c/private/ppb_nacl_private.h @@ -5,10 +5,12 @@ #ifndef PPAPI_C_PRIVATE_PPB_NACL_UTIL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_UTIL_PRIVATE_H_ +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" -#define PPB_NACL_PRIVATE_INTERFACE "PPB_NaCl(Private);0.4" +#define PPB_NACL_PRIVATE_INTERFACE "PPB_NaCl(Private);0.5" struct PPB_NaCl_Private { // This function launches NaCl's sel_ldr process. On success, the function @@ -16,8 +18,14 @@ struct PPB_NaCl_Private { // write |socket_count| nacl::Handles to imc_handles. Unless // EnableBackgroundSelLdrLaunch is called, this method must be invoked from // the main thread. - bool (*LaunchSelLdr)(const char* alleged_url, int socket_count, - void* imc_handles); + PP_Bool (*LaunchSelLdr)(PP_Instance instance, + const char* alleged_url, + int socket_count, + void* imc_handles); + + // This function starts the PPAPI proxy so the nexe can communicate with the + // browser's renderer process. + PP_Bool (*StartPpapiProxy)(PP_Instance instance); // On POSIX systems, this function returns the file descriptor of // /dev/urandom. On non-POSIX systems, this function returns 0. diff --git a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h index 7c60ad8..8074e5f 100644 --- a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h +++ b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h @@ -13,16 +13,21 @@ #include <string> #include "native_client/src/shared/imc/nacl_imc.h" +#include "ppapi/c/pp_instance.h" -typedef bool (*LaunchNaClProcessFunc)(const char* url, +typedef bool (*LaunchNaClProcessFunc)(PP_Instance instance, + const char* url, int socket_count, nacl::Handle* result_sockets); +typedef bool (*StartPpapiProxyFunc)(PP_Instance instance); + typedef int (*GetURandomFDFunc)(void); extern LaunchNaClProcessFunc launch_nacl_process; +extern StartPpapiProxyFunc start_ppapi_proxy; extern GetURandomFDFunc get_urandom_fd; #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_NACL_ENTRY_POINTS_H_ diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc index c32209b..d301612 100644 --- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc +++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc @@ -11,11 +11,18 @@ LaunchNaClProcessFunc launch_nacl_process = NULL; namespace plugin { bool SelLdrLauncherChrome::Start(const char* url) { + return Start(0, url); +} + +bool SelLdrLauncherChrome::Start(PP_Instance instance, const char* url) { // send a synchronous message to the browser process // TODO(sehr): This is asserted to be one. Remove this parameter. static const int kNumberOfChannelsToBeCreated = 1; if (!launch_nacl_process || - !launch_nacl_process(url, kNumberOfChannelsToBeCreated, &channel_)) { + !launch_nacl_process(instance, + url, + kNumberOfChannelsToBeCreated, + &channel_)) { return false; } return true; diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h index 2450cf3..e479499 100644 --- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h +++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h @@ -6,12 +6,14 @@ #define PPAPI_NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SEL_LDR_LAUNCHER_CHROME_H_ #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" +#include "ppapi/c/pp_instance.h" namespace plugin { class SelLdrLauncherChrome : public nacl::SelLdrLauncherBase { public: virtual bool Start(const char* url); + virtual bool Start(PP_Instance instance, const char* url); }; } // namespace plugin diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc index 8a75b1e..f5b948a 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc @@ -628,11 +628,12 @@ bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, PLUGIN_PRINTF(("ServiceRuntime::Start (nacl_desc=%p)\n", reinterpret_cast<void*>(nacl_desc))); - nacl::scoped_ptr<nacl::SelLdrLauncherBase> tmp_subprocess; #ifdef NACL_STANDALONE - tmp_subprocess.reset(new nacl::SelLdrLauncherStandalone()); + nacl::scoped_ptr<nacl::SelLdrLauncherStandalone> + tmp_subprocess(new nacl::SelLdrLauncherStandalone()); #else - tmp_subprocess.reset(new SelLdrLauncherChrome()); + nacl::scoped_ptr<SelLdrLauncherChrome> + tmp_subprocess(new SelLdrLauncherChrome()); #endif if (NULL == tmp_subprocess.get()) { PLUGIN_PRINTF(("ServiceRuntime::Start (subprocess create failed)\n")); @@ -640,7 +641,12 @@ bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, "ServiceRuntime: failed to create sel_ldr launcher"); return false; } - if (!tmp_subprocess->Start(url.c_str())) { +#ifdef NACL_STANDALONE + bool started = tmp_subprocess->Start(url.c_str()); +#else + bool started = tmp_subprocess->Start(plugin_->pp_instance(), url.c_str()); +#endif + if (!started) { PLUGIN_PRINTF(("ServiceRuntime::Start (start failed)\n")); error_info->SetReport(ERROR_SEL_LDR_LAUNCH, "ServiceRuntime: failed to start"); |