pp__array__output_8h.html revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
1{{+bindTo:partials.standard_nacl_article}} 2<h1>pp_array_output.h File Reference</h1> 3<div id="doxygen-ref"> 4{{- dummy div to appease doxygen -}} 5 <div> 6<!-- Generated by Doxygen 1.7.6.1 --> 7 8 9</div> 10<!--header--> 11<div class="contents"> 12<div class="textblock"><div class="dynheader"> 13Include dependency graph for pp_array_output.h:</div> 14<div class="dyncontent"> 15<div class="center"><img src="pp__array__output_8h__incl.png" border="0" usemap="#pp__array__output_8h" alt="" /></div> 16<map name="pp__array__output_8h" id="pp__array__output_8h"> 17</map> 18</div> 19</div><h2> 20Data Structures</h2><table class="memberdecls"> 21 22<tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p___array_output.html">PP_ArrayOutput</a></td></tr> 23<tr><td class="mdescLeft"> </td><td class="mdescRight">A structure that defines a way for the browser to return arrays of data to the plugin. <a href="struct_p_p___array_output.html#details">More...</a><br /></td></tr> 24</table><h2> 25Typedefs</h2><table class="memberdecls"> 26<tr><td class="memItemLeft" align="right" valign="top">typedef void *(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group___typedefs.html#gaa363de651fad7342a37ec58375276af7">PP_ArrayOutput_GetDataBuffer</a> )(void *user_data, uint32_t element_count, uint32_t element_size)</td></tr> 27</table> 28<hr /><a name="details" id="details"></a><h2>Detailed Description</h2> 29<div class="textblock"><p>PP_ArrayOutput_GetDataBuffer is a callback function to allocate plugin memory for an array. </p> 30<p>It returns the allocated memory or null on failure.</p> 31<p>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.</p> 32<p>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.</p> 33<p>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.</p> 34<p>The C++ wrapper provides a convenient templatized implementation around std::vector which you should generally use instead of coding this specifically.</p> 35<dl class="params"><dt><b>Parameters:</b></dt><dd> 36<table class="params"> 37<tr><td class="paramname">user_data</td><td>The pointer provided in the <a class="el" href="struct_p_p___array_output.html" title="A structure that defines a way for the browser to return arrays of data to the plugin.">PP_ArrayOutput</a> 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.</td></tr> 38<tr><td class="paramname">element_count</td><td>The number of elements in the array. This will be 0 if there is no data to return.</td></tr> 39<tr><td class="paramname">element_size</td><td>The size of each element in bytes.</td></tr> 40</table> 41</dd> 42</dl> 43<dl class="return"><dt><b>Returns:</b></dt><dd>Returns a pointer to the allocated memory. On failure, returns null. You can also return null if the element_count is 0. When a non-null value is returned, the buffer must remain valid until after the callback runs. If used with a blocking callback, the buffer must remain valid until after the function returns. The plugin can then free any memory that it allocated. </dd></dl> 44</div></div><!-- contents --> 45</div> 46{{/partials.standard_nacl_article}} 47