chromium/native_client_sdk/doc_generated/pepper_beta/c/struct_p_p___completion_callback.html

{{+bindTo:partials.standard_nacl_api}}
<h1>PP_CompletionCallback Struct Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
  <div>
<!-- Generated by Doxygen 1.7.6.1 -->


</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="PP_CompletionCallback" --><h2>
Data Fields</h2><table class="memberdecls">

<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#ga6fe12e1a41df5e10103a811036d4d8d2">PP_CompletionCallback_Func</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p___completion_callback.html#ac8919fd5c44ffdde5e659b51bc696ed4">func</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p___completion_callback.html#a7a35a0fdb8e1c49c738e29bbc93066cb">user_data</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p___completion_callback.html#a4bd2d9440bc8dc18eeeca2d464156a38">flags</a></td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> is a common mechanism for supporting potentially asynchronous calls in browser interfaces. </p>
<p>Any method that takes a <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> can be used in one of three different ways:</p>
<ul>
<li>Required: The callback will always be invoked asynchronously on the thread where the associated PPB method was invoked. The method will always return PP_OK_COMPLETIONPENDING when a required callback, and the callback will be invoked later (barring system or thread shutdown; see PPB_MessageLoop for details). Required callbacks are the default. <br />
<br />
 NOTE: If you use a required callback on a background thread, you must have created and attached a PPB_MessageLoop. Otherwise, the system can not run your callback on that thread, and will instead emit a log message and crash your plugin to make the problem more obvious.</li>
</ul>
<ul>
<li>Optional: The callback may be invoked asynchronously, or the PPB method may complete synchronously if it can do so without blocking. If the method will complete asynchronously, it will return PP_OK_COMPLETIONPENDING. Otherwise, it will complete synchronously and return an appropriate code (see below for more information on the return code). Optional callbacks are generally more difficult to use correctly than Required callbacks, but can provide better performance for some APIs (especially APIs with buffered reads, such as PPB_URLLoader or PPB_FileIO). <br />
<br />
 NOTE: If you use an optional callback on a background thread, and you have not created and attached a PPB_MessageLoop, then the method you invoke will fail without running and return PP_ERROR_NO_MESSAGE_LOOP.</li>
</ul>
<ul>
<li>Blocking: In this case, the callback's function pointer is NULL, and the invoked method must complete synchronously. The method will run to completion and return an appropriate code when finished (see below for more information). Blocking completion callbacks are only supported on background threads. <br />
<br />
<code><a class="el" href="group___functions.html#ga340e452b4931d17bd44928769490e282" title="PP_BlockUntilComplete() is used in place of an actual completion callback to request blocking behavio...">PP_BlockUntilComplete()</a></code> provides a convenient way to specify blocking behavior. Refer to <code>PP_BlockUntilComplete</code> for more information.</li>
</ul>
<p>When the callback is run asynchronously, the result parameter passed to <code>func</code> is an int32_t that, if negative indicates an error code whose meaning is specific to the calling method (refer to <code>pp_error.h</code> for further information). A positive or 0 value is a return result indicating success whose meaning depends on the calling method (e.g. number of bytes read). </p>
</div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="a4bd2d9440bc8dc18eeeca2d464156a38"></a><!-- doxytag: member="PP_CompletionCallback::flags" ref="a4bd2d9440bc8dc18eeeca2d464156a38" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="struct_p_p___completion_callback.html#a4bd2d9440bc8dc18eeeca2d464156a38">PP_CompletionCallback::flags</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Flags used to control how non-NULL callbacks are scheduled by asynchronous methods. </p>
</div>
</div>
<a class="anchor" id="ac8919fd5c44ffdde5e659b51bc696ed4"></a><!-- doxytag: member="PP_CompletionCallback::func" ref="ac8919fd5c44ffdde5e659b51bc696ed4" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#ga6fe12e1a41df5e10103a811036d4d8d2">PP_CompletionCallback_Func</a> <a class="el" href="struct_p_p___completion_callback.html#ac8919fd5c44ffdde5e659b51bc696ed4">PP_CompletionCallback::func</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This value is a callback function that will be called, or NULL if this is a blocking completion callback. </p>
</div>
</div>
<a class="anchor" id="a7a35a0fdb8e1c49c738e29bbc93066cb"></a><!-- doxytag: member="PP_CompletionCallback::user_data" ref="a7a35a0fdb8e1c49c738e29bbc93066cb" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* <a class="el" href="struct_p_p___completion_callback.html#a7a35a0fdb8e1c49c738e29bbc93066cb">PP_CompletionCallback::user_data</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This value is a pointer to user data passed to a callback function. </p>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="pp__completion__callback_8h.html">pp_completion_callback.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}