diff options
-rw-r--r-- | ppapi/c/private/ppb_nacl_util_private.h | 14 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_nacl_util_private_impl.cc | 16 |
2 files changed, 28 insertions, 2 deletions
diff --git a/ppapi/c/private/ppb_nacl_util_private.h b/ppapi/c/private/ppb_nacl_util_private.h index 3a8354e..462477f 100644 --- a/ppapi/c/private/ppb_nacl_util_private.h +++ b/ppapi/c/private/ppb_nacl_util_private.h @@ -11,7 +11,19 @@ #define PPB_NACLUTIL_PRIVATE_INTERFACE "PPB_NaClUtil(Private);0.1" struct PPB_NaClUtil_Private { - int32_t (*LaunchSelLdr)(PP_Resource file_io); + // 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|. + bool (*LaunchSelLdr)(const char* alleged_url, int socket_count, + void* imc_handles, void* nacl_process_handle, + int* nacl_process_id); + + // On POSIX systems, this function returns the file descriptor of + // /dev/urandom. On non-POSIX systems, this function returns 0. + int (*UrandomFD)(void); }; #endif // PPAPI_C_PRIVATE_PPB_NACL_UTIL_PRIVATE_H_ diff --git a/webkit/plugins/ppapi/ppb_nacl_util_private_impl.cc b/webkit/plugins/ppapi/ppb_nacl_util_private_impl.cc index 72dc76a..df937cb 100644 --- a/webkit/plugins/ppapi/ppb_nacl_util_private_impl.cc +++ b/webkit/plugins/ppapi/ppb_nacl_util_private_impl.cc @@ -4,21 +4,35 @@ #include "webkit/plugins/ppapi/ppb_nacl_util_private_impl.h" +#include "base/rand_util_c.h" #include "ppapi/c/private/ppb_nacl_util_private.h" +#include "webkit/glue/webkit_glue.h" namespace webkit { namespace ppapi { namespace { -int32_t LaunchSelLdr(PP_Resource file_io) { +bool LaunchSelLdr(const char* alleged_url, int socket_count, + void* imc_handles, void* nacl_process_handle, + int* nacl_process_id) { + return webkit_glue::LaunchSelLdr(alleged_url, socket_count, imc_handles, + nacl_process_handle, nacl_process_id); +} + +int UrandomFD(void) { +#if defined(OS_POSIX) + return GetUrandomFD(); +#else return 0; +#endif } } // namespace const PPB_NaClUtil_Private ppb_nacl_util = { &LaunchSelLdr, + &UrandomFD, }; // static |