Native Client

pp_array_output.h File Reference

PP_ArrayOutput_GetDataBuffer is a callback function to allocate plugin memory for an array. More...

Include dependency graph for pp_array_output.h:
This graph shows which files directly or indirectly include this file:

Interfaces or Structures

struct  PP_ArrayOutput
 A structure that defines a way for the browser to return arrays of data to the plugin. More...

Typedefs

typedef void *(* PP_ArrayOutput_GetDataBuffer )(void *user_data, uint32_t element_count, uint32_t element_size)

Detailed Description

PP_ArrayOutput_GetDataBuffer is a callback function to allocate plugin memory for an array.

It returns the allocated memory or null on failure.

This function will be called reentrantly. This means that if you call a function PPB_Foo.GetData(&array_output), GetData will call your GetDataBuffer function before it returns.

This function will be called even when returning 0-length arrays, so be sure your implementation can support that. You can return NULL for 0 length arrays and it will not be treated as a failure.

You should not perform any processing in this callback, including calling other PPAPI functions, outside of allocating memory. You should not throw any exceptions. In C++, this means using "new (nothrow)" or being sure to catch any exceptions before returning.

The C++ wrapper provides a convenient templatized implementation around std::vector which you should generally use instead of coding this specifically.

Parameters:
user_dataThe pointer provided in the PP_ArrayOutput structure. This has no meaning to the browser, it is intended to be used by the implementation to figure out where to put the data.
element_countThe number of elements in the array. This will be 0 if there is no data to return.
element_sizeThe size of each element in bytes.
Returns:
Returns a pointer to the allocated memory. On failure, returns null. You can also return null if the element_count is 0.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.