blob: 0732a1f38b20810cec5179d81c3df015eb42b904 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>pp::Core Class 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::Core" -->
<p><a href="classpp_1_1_core-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_core.html#a09c663df7fcb527b3e5e71ea07531899">AddRefResource</a> (PP_Resource resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_core.html#a5fd1b4530d9f01ebf3c50115238a8195">ReleaseResource</a> (PP_Resource resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">PP_Time&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_core.html#a8c7991d43fc5b4fce51095ad7dccaec1">GetTime</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">PP_TimeTicks&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_core.html#ae80748da9fe60f2b83fbf3e18978f86f">GetTimeTicks</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_core.html#af20d1f92600f588bc74115fcbd17a1c7">CallOnMainThread</a> (int32_t delay_in_milliseconds, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;callback, int32_t result=0)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_core.html#a052082be868f24d1f1807afa4eb7e7e4">IsMainThread</a> ()</td></tr>
</table><h2>
Friends</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_core.html#a21f639900c480510650969df9c74d17d">Module</a></td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>APIs related to memory management, time, and threads. </p>
</div><hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="a09c663df7fcb527b3e5e71ea07531899"></a><!-- doxytag: member="pp::Core::AddRefResource" ref="a09c663df7fcb527b3e5e71ea07531899" args="(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_core.html#a09c663df7fcb527b3e5e71ea07531899">pp::Core::AddRefResource</a> </td>
<td>(</td>
<td class="paramtype">PP_Resource&#160;</td>
<td class="paramname"><em>resource</em></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_core.html#a09c663df7fcb527b3e5e71ea07531899" title="AddRefResource() increments the reference count for the provided resource.">AddRefResource()</a> increments the reference count for the provided <code>resource</code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a resource. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="af20d1f92600f588bc74115fcbd17a1c7"></a><!-- doxytag: member="pp::Core::CallOnMainThread" ref="af20d1f92600f588bc74115fcbd17a1c7" args="(int32_t delay_in_milliseconds, const CompletionCallback &amp;callback, int32_t result=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_core.html#af20d1f92600f588bc74115fcbd17a1c7">pp::Core::CallOnMainThread</a> </td>
<td>(</td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>delay_in_milliseconds</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
<td class="paramname"><em>callback</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>result</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_core.html#af20d1f92600f588bc74115fcbd17a1c7" title="CallOnMainThread() schedules work to be executed on the main pepper thread after the specified delay...">CallOnMainThread()</a> schedules work to be executed on the main pepper thread after the specified delay. </p>
<p>The delay may be 0 to specify a call back as soon as possible.</p>
<p>The |result| parameter will just be passed as the second argument to the callback. Many applications won't need this, but it allows a module to emulate calls of some callbacks which do use this value.</p>
<p><b>Note:</b> <a class="el" href="classpp_1_1_core.html#af20d1f92600f588bc74115fcbd17a1c7" title="CallOnMainThread() schedules work to be executed on the main pepper thread after the specified delay...">CallOnMainThread()</a>, even when used from the main thread with a delay of 0 milliseconds, will never directly invoke the callback. Even in this case, the callback will be scheduled asynchronously.</p>
<p><b>Note:</b> If the browser is shutting down or if the module has no instances, then the callback function may not be called.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">delay_in_milliseconds</td><td>An int32_t delay in milliseconds. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> callback function that the browser will call after the specified delay. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">result</td><td>An int32_t that the browser will pass to the given <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a8c7991d43fc5b4fce51095ad7dccaec1"></a><!-- doxytag: member="pp::Core::GetTime" ref="a8c7991d43fc5b4fce51095ad7dccaec1" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">PP_Time <a class="el" href="classpp_1_1_core.html#a8c7991d43fc5b4fce51095ad7dccaec1">pp::Core::GetTime</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_core.html#a8c7991d43fc5b4fce51095ad7dccaec1" title='GetTime() returns the "wall clock time" according to the browser.'>GetTime()</a> returns the "wall clock time" according to the browser. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Time</code> containing the "wall clock time" according to the browser. </dd></dl>
</div>
</div>
<a class="anchor" id="ae80748da9fe60f2b83fbf3e18978f86f"></a><!-- doxytag: member="pp::Core::GetTimeTicks" ref="ae80748da9fe60f2b83fbf3e18978f86f" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">PP_TimeTicks <a class="el" href="classpp_1_1_core.html#ae80748da9fe60f2b83fbf3e18978f86f">pp::Core::GetTimeTicks</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_core.html#ae80748da9fe60f2b83fbf3e18978f86f" title='GetTimeTicks() returns the "tick time" according to the browser.'>GetTimeTicks()</a> returns the "tick time" according to the browser. </p>
<p>This clock is used by the browser when passing some event times to the module (for example, using the <code>PP_InputEvent::time_stamp_seconds</code> field). It is not correlated to any actual wall clock time (like <a class="el" href="classpp_1_1_core.html#a8c7991d43fc5b4fce51095ad7dccaec1" title='GetTime() returns the "wall clock time" according to the browser.'>GetTime()</a>). Because of this, it will not change if the user changes their computer clock.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_TimeTicks</code> containing the "tick time" according to the browser. </dd></dl>
</div>
</div>
<a class="anchor" id="a052082be868f24d1f1807afa4eb7e7e4"></a><!-- doxytag: member="pp::Core::IsMainThread" ref="a052082be868f24d1f1807afa4eb7e7e4" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="classpp_1_1_core.html#a052082be868f24d1f1807afa4eb7e7e4">pp::Core::IsMainThread</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_core.html#a052082be868f24d1f1807afa4eb7e7e4" title="IsMainThread() returns true if the current thread is the main pepper thread.">IsMainThread()</a> returns true if the current thread is the main pepper thread. </p>
<p>This function is useful for implementing sanity checks, and deciding if dispatching using <a class="el" href="classpp_1_1_core.html#af20d1f92600f588bc74115fcbd17a1c7" title="CallOnMainThread() schedules work to be executed on the main pepper thread after the specified delay...">CallOnMainThread()</a> is required.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the current thread is the main pepper thread, otherwise false. </dd></dl>
</div>
</div>
<a class="anchor" id="a5fd1b4530d9f01ebf3c50115238a8195"></a><!-- doxytag: member="pp::Core::ReleaseResource" ref="a5fd1b4530d9f01ebf3c50115238a8195" args="(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_core.html#a5fd1b4530d9f01ebf3c50115238a8195">pp::Core::ReleaseResource</a> </td>
<td>(</td>
<td class="paramtype">PP_Resource&#160;</td>
<td class="paramname"><em>resource</em></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_core.html#a5fd1b4530d9f01ebf3c50115238a8195" title="ReleaseResource() decrements the reference count for the provided resource.">ReleaseResource()</a> decrements the reference count for the provided <code>resource</code>. </p>
<p>The resource will be deallocated if the reference count reaches zero.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> corresponding to a resource. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr /><h2>Friends And Related Function Documentation</h2>
<a class="anchor" id="a21f639900c480510650969df9c74d17d"></a><!-- doxytag: member="pp::Core::Module" ref="a21f639900c480510650969df9c74d17d" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">friend class <a class="el" href="classpp_1_1_module.html">Module</a><code> [friend]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="core_8h.html">core.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}