Functions

struct PP_CompletionCallback PP_MakeCompletionCallback (PP_CompletionCallback_Func func, void *user_data)
struct PP_CompletionCallback PP_MakeOptionalCompletionCallback (PP_CompletionCallback_Func func, void *user_data)
void PP_RunCompletionCallback (struct PP_CompletionCallback *cc, int32_t result)
struct PP_CompletionCallback PP_BlockUntilComplete (void)
void PP_RunAndClearCompletionCallback (struct PP_CompletionCallback *cc, int32_t res)
struct PP_Point PP_MakePoint (int32_t x, int32_t y)
struct PP_FloatPoint PP_MakeFloatPoint (float x, float y)
struct PP_Rect PP_MakeRectFromXYWH (int32_t x, int32_t y, int32_t w, int32_t h)
struct PP_FloatRect PP_MakeFloatRectFromXYWH (float x, float y, float w, float h)
struct PP_Size PP_MakeSize (int32_t w, int32_t h)
struct PP_FloatSize PP_MakeFloatSize (float w, float h)
struct PP_TouchPoint PP_MakeTouchPoint (void)
struct PP_Var PP_MakeUndefined (void)
struct PP_Var PP_MakeNull (void)
struct PP_Var PP_MakeBool (PP_Bool value)
struct PP_Var PP_MakeInt32 (int32_t value)
struct PP_Var PP_MakeDouble (double value)
int32_t PPP_InitializeModule (PP_Module module, PPB_GetInterface get_browser_interface)
void PPP_ShutdownModule (void)
const void * PPP_GetInterface (const char *interface_name)

Function Documentation

PP_BlockUntilComplete() is used in place of an actual completion callback to request blocking behavior.

If specified, the calling thread will block until the function completes. Blocking completion callbacks are only allowed from background threads.

Returns:
A PP_CompletionCallback structure.
struct PP_Var PP_MakeBool(PP_Bool value) [read]

PP_MakeBool() is used to wrap a boolean value into a PP_Var struct for passing to the browser.

Parameters:
[in]valueA PP_Bool enumeration to wrap.
Returns:
A PP_Var structure.

PP_MakeCompletionCallback() is used to create a PP_CompletionCallback.

Example, creating a Required callback:

Example, creating an Optional callback:

Parameters:
[in]funcA PP_CompletionCallback_Func that will be called.
[in]user_dataA pointer to user data passed to your callback function. This is optional and is typically used to help track state when you may have multiple callbacks pending.
Returns:
A PP_CompletionCallback structure.
struct PP_Var PP_MakeDouble(double value) [read]

PP_MakeDouble() is used to wrap a double value into a PP_Var struct for passing to the browser.

Parameters:
[in]valueA double to wrap.
Returns:
A PP_Var structure.
struct PP_FloatPoint PP_MakeFloatPoint(float x,
float y 
) [read]
struct PP_FloatRect PP_MakeFloatRectFromXYWH(float x,
float y,
float w,
float h 
) [read]

PP_MakeFloatRectFromXYWH() creates a PP_FloatRect given x and y coordinates and width and height dimensions as float values.

Parameters:
[in]xAn float value representing a horizontal coordinate of a point, starting with 0 as the left-most coordinate.
[in]yAn float value representing a vertical coordinate of a point, starting with 0 as the top-most coordinate.
[in]wAn float value representing a width.
[in]hAn float value representing a height.
Returns:
A PP_FloatRect structure.
struct PP_FloatSize PP_MakeFloatSize(float w,
float h 
) [read]

PP_MakeFloatSize() creates a PP_FloatSize given a width and height as float values.

Parameters:
[in]wAn float value representing a width.
[in]hAn float value representing a height.
Returns:
A PP_FloatSize structure.
struct PP_Var PP_MakeInt32(int32_t value) [read]

PP_MakeInt32() is used to wrap a 32 bit integer value into a PP_Var struct for passing to the browser.

Parameters:
[in]valueAn int32 to wrap.
Returns:
A PP_Var structure.
struct PP_Var PP_MakeNull(void ) [read]

PP_MakeNull() is used to wrap a null value into a PP_Var struct for passing to the browser.

Returns:
A PP_Var structure,

PP_MakeOptionalCompletionCallback() is used to create a PP_CompletionCallback with PP_COMPLETIONCALLBACK_FLAG_OPTIONAL set.

Parameters:
[in]funcA PP_CompletionCallback_Func to be called on completion.
[in]user_dataA pointer to user data passed to be passed to the callback function. This is optional and is typically used to help track state in case of multiple pending callbacks.
Returns:
A PP_CompletionCallback structure.
struct PP_Point PP_MakePoint(int32_t x,
int32_t y 
) [read]

PP_MakePoint() creates a PP_Point given the x and y coordinates as int32_t values.

Parameters:
[in]xAn int32_t value representing a horizontal coordinate of a point, starting with 0 as the left-most coordinate.
[in]yAn int32_t value representing a vertical coordinate of a point, starting with 0 as the top-most coordinate.
Returns:
A PP_Point structure.
struct PP_Rect PP_MakeRectFromXYWH(int32_t x,
int32_t y,
int32_t w,
int32_t h 
) [read]

PP_MakeRectFromXYWH() creates a PP_Rect given x and y coordinates and width and height dimensions as int32_t values.

Parameters:
[in]xAn int32_t value representing a horizontal coordinate of a point, starting with 0 as the left-most coordinate.
[in]yAn int32_t value representing a vertical coordinate of a point, starting with 0 as the top-most coordinate.
[in]wAn int32_t value representing a width.
[in]hAn int32_t value representing a height.
Returns:
A PP_Rect structure.
struct PP_Size PP_MakeSize(int32_t w,
int32_t h 
) [read]

PP_MakeSize() creates a PP_Size given a width and height as int32_t values.

Parameters:
[in]wAn int32_t value representing a width.
[in]hAn int32_t value representing a height.
Returns:
A PP_Size structure.
struct PP_TouchPoint PP_MakeTouchPoint(void ) [read]

PP_MakeTouchPoint() creates a PP_TouchPoint.

Returns:
A PP_TouchPoint structure.
struct PP_Var PP_MakeUndefined(void ) [read]

PP_MakeUndefined() is used to wrap an undefined value into a PP_Var struct for passing to the browser.

Returns:
A PP_Var structure.

PP_RunAndClearCompletionCallback() runs a callback and clears the reference to that callback.

This function is used when the null-ness of a completion callback is used as a signal for whether a completion callback has been registered. In this case, after the execution of the callback, it should be cleared. However, this introduces a conflict if the completion callback wants to schedule more work that involves the same completion callback again (for example, when reading data from an URLLoader, one would typically queue up another read callback). As a result, this function clears the pointer before the provided callback is executed.

void PP_RunCompletionCallback(struct PP_CompletionCallbackcc,
int32_t result 
)

PP_RunCompletionCallback() is used to run a callback.

It invokes the callback function passing it user data specified on creation and completion |result|.

Parameters:
[in]ccA pointer to a PP_CompletionCallback that will be run.
[in]resultThe result of the operation. Non-positive values correspond to the error codes from pp_errors.h (excluding PP_OK_COMPLETIONPENDING). Positive values indicate additional information such as bytes read.
const void* PPP_GetInterface(const char * interface_name)

PPP_GetInterface() is called by the browser to query the module for interfaces it supports.

Your module must implement the PPP_Instance interface or it will be unloaded. Other interfaces are optional.

This function is called from within browser code whenever an interface is needed. This means your plugin could be reentered via this function if you make a browser call and it needs an interface. Furthermore, you should not make any other browser calls from within your implementation to avoid reentering the browser.

As a result, your implementation of this should merely provide a lookup from the requested name to an interface pointer, via something like a big if/else block or a map, and not do any other work.

Parameters:
[in]interface_nameA pointer to a "PPP" (plugin) interface name. Interface names are null-terminated ASCII strings.
Returns:
A pointer for the interface or NULL if the interface is not supported.
int32_t PPP_InitializeModule(PP_Module module,
PPB_GetInterface get_browser_interface 
)

PPP_InitializeModule() is the entry point for a module and is called by the browser when your module loads.

Your code must implement this function.

Failure indicates to the browser that this module can not be used. In this case, the module will be unloaded and ShutdownModule will NOT be called.

Parameters:
[in]moduleA handle to your module. Generally you should store this value since it will be required for other API calls.
[in]get_browser_interfaceA pointer to the function that you can use to query for browser interfaces. Generally you should store this value for future use.
Returns:
PP_OK on success. Any other value on failure.
void PPP_ShutdownModule(void )

PPP_ShutdownModule() is sometimes called before the module is unloaded.

It is not recommended that you implement this function.

There is no practical use of this function for third party modules. Its existence is because of some internal use cases inside Chrome.

Since your module runs in a separate process, there's no need to free allocated memory. There is also no need to free any resources since all of resources associated with an instance will be force-freed when that instance is deleted.

Note: This function will always be skipped on untrusted (Native Client) implementations. This function may be skipped on trusted implementations in certain circumstances when Chrome does "fast shutdown" of a web page.

This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.