Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Functions
pepper_main.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <fcntl.h>
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb.h"
#include "ppapi/c/ppb_core.h"
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/c/ppb_messaging.h"
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/c/ppb_url_request_info.h"
#include "ppapi/c/ppb_url_response_info.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/ppp_messaging.h"
#include "nacl_io/nacl_io.h"
#include "verconf.h"
#include "ruby/ruby.h"
#include "version.h"
#include "gc.h"

Go to the source code of this file.

Data Structures

struct  PepperInstance
 

Macros

#define GET_PEPPER_INSTANCE()   (pruby_get_instance(current_instance))
 
#define EVAL_PREFIX_LEN   5
 

Functions

struct PepperInstancepruby_get_instance (PP_Instance instance)
 
struct PepperInstancepruby_register_instance (PP_Instance instance)
 
int pruby_unregister_instance (PP_Instance instance)
 
void pruby_async_return_int (void *data, int32_t result)
 
void pruby_async_return_str (void *data, const char *result)
 
void pruby_async_return_value (void *data, VALUE value)
 
int pruby_var_equal_to_cstr_p (struct PP_Var lhs, const char *rhs)
 
int pruby_var_prefixed_p (struct PP_Var var, const char *prefix)
 
void pruby_post_cstr (void *data)
 
void pruby_post_value (void *data)
 
void Messaging_HandleMessage (PP_Instance instance, struct PP_Var var_message)
 Handler for messages coming in from the browser via postMessage. More...
 
PP_EXPORT int32_t PPP_InitializeModule (PP_Module a_module_id, PPB_GetInterface a_get_browser_interface)
 Entry points for the module. More...
 
PP_EXPORT const void * PPP_GetInterface (const char *interface_name)
 Returns an interface pointer for the interface of the given name, or NULL if the interface is not supported. More...
 
PP_EXPORT void PPP_ShutdownModule (void)
 Called before the plugin module is unloaded. More...
 

Macro Definition Documentation

◆ EVAL_PREFIX_LEN

#define EVAL_PREFIX_LEN   5

◆ GET_PEPPER_INSTANCE

#define GET_PEPPER_INSTANCE ( )    (pruby_get_instance(current_instance))

Definition at line 116 of file pepper_main.c.

Function Documentation

◆ Messaging_HandleMessage()

void Messaging_HandleMessage ( PP_Instance  instance,
struct PP_Var  var_message 
)

Handler for messages coming in from the browser via postMessage.

The var_message can contain anything: a JSON string; a string that encodes method names and arguments; etc. For example, you could use JSON.stringify in the browser to create a message that contains a method name and some parameters, something like this: var json_message = JSON.stringify({ "myMethod" : "3.14159" }); nacl_module.postMessage(json_message); On receipt of this message in var_message, you could parse the JSON to retrieve the method name, match it to a function call, and then call it with the parameter.

Parameters
[in]instanceThe instance ID.
[in]messageThe contents, copied by value, of the message sent from browser via postMessage.

Definition at line 639 of file pepper_main.c.

◆ PPP_GetInterface()

PP_EXPORT const void* PPP_GetInterface ( const char *  interface_name)

Returns an interface pointer for the interface of the given name, or NULL if the interface is not supported.

Parameters
[in]interface_namename of the interface
Returns
pointer to the interface

Definition at line 705 of file pepper_main.c.

◆ PPP_InitializeModule()

PP_EXPORT int32_t PPP_InitializeModule ( PP_Module  a_module_id,
PPB_GetInterface  a_get_browser_interface 
)

Entry points for the module.

Initialize instance interface and scriptable object class.

Parameters
[in]a_module_idModule ID
[in]get_browser_interfacePointer to PPB_GetInterface
Returns
PP_OK on success, any other value on failure.

Definition at line 670 of file pepper_main.c.

◆ PPP_ShutdownModule()

PP_EXPORT void PPP_ShutdownModule ( void  )

Called before the plugin module is unloaded.

Definition at line 729 of file pepper_main.c.

References ruby_cleanup().

◆ pruby_async_return_int()

void pruby_async_return_int ( void *  data,
int32_t  result 
)

Definition at line 171 of file pepper_main.c.

◆ pruby_async_return_str()

void pruby_async_return_str ( void *  data,
const char *  result 
)

Definition at line 182 of file pepper_main.c.

◆ pruby_async_return_value()

void pruby_async_return_value ( void *  data,
VALUE  value 
)

◆ pruby_get_instance()

struct PepperInstance* pruby_get_instance ( PP_Instance  instance)

Definition at line 103 of file pepper_main.c.

References rb_hash_aref().

◆ pruby_post_cstr()

void pruby_post_cstr ( void *  data)

Definition at line 318 of file pepper_main.c.

References PepperInstance::instance.

◆ pruby_post_value()

void pruby_post_value ( void *  data)

Definition at line 330 of file pepper_main.c.

References PepperInstance::async_call_args, and PepperInstance::instance.

◆ pruby_register_instance()

struct PepperInstance* pruby_register_instance ( PP_Instance  instance)

◆ pruby_unregister_instance()

int pruby_unregister_instance ( PP_Instance  instance)

Definition at line 136 of file pepper_main.c.

References rb_hash_delete().

◆ pruby_var_equal_to_cstr_p()

int pruby_var_equal_to_cstr_p ( struct PP_Var  lhs,
const char *  rhs 
)

Definition at line 284 of file pepper_main.c.

References len.

◆ pruby_var_prefixed_p()

int pruby_var_prefixed_p ( struct PP_Var  var,
const char *  prefix 
)

Definition at line 297 of file pepper_main.c.

References len.