blob: 6443704883b0d1b26022a6b72ac6f17e602fe1b7 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_FileMapping 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="PPB_FileMapping" --><h2>
Data Fields</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_mapping__0__1.html#a425d8d5b11de51e8edf539ee13bac1fb">Map</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t length, uint32_t map_protection, uint32_t map_flags, int64_t offset, void **address, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</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_b___file_mapping__0__1.html#a4fa72d6e6660e16ce1ff08453eff172d">Unmap</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, const void *address, int64_t length, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int64_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___file_mapping__0__1.html#ae479690b258985b51dda4d438b8156f0">GetMapPageSize</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>PPB_FileMapping contains functions for mapping and unmapping files into and out of memory. </p>
</div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="ae479690b258985b51dda4d438b8156f0"></a><!-- doxytag: member="PPB_FileMapping::GetMapPageSize" ref="ae479690b258985b51dda4d438b8156f0" args=")(PP_Instance instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int64_t(* <a class="el" href="struct_p_p_b___file_mapping__0__1.html#ae479690b258985b51dda4d438b8156f0">PPB_FileMapping::GetMapPageSize</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_mapping__0__1.html#ae479690b258985b51dda4d438b8156f0" title="GetMapPageSize() retrieves the size of pages that Map() uses.">GetMapPageSize()</a> retrieves the size of pages that <a class="el" href="struct_p_p_b___file_mapping__0__1.html#a425d8d5b11de51e8edf539ee13bac1fb" title="Map() maps the contents from an offset of the file into memory.">Map()</a> uses. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>A <code>PP_Instance</code> identifying the instance.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The size of pages that <a class="el" href="struct_p_p_b___file_mapping__0__1.html#a425d8d5b11de51e8edf539ee13bac1fb" title="Map() maps the contents from an offset of the file into memory.">Map()</a> uses. Returns 0 on failure. </dd></dl>
</div>
</div>
<a class="anchor" id="a425d8d5b11de51e8edf539ee13bac1fb"></a><!-- doxytag: member="PPB_FileMapping::Map" ref="a425d8d5b11de51e8edf539ee13bac1fb" args=")(PP_Instance instance, PP_Resource file_io, int64_t length, uint32_t map_protection, uint32_t map_flags, int64_t offset, void **address, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_mapping__0__1.html#a425d8d5b11de51e8edf539ee13bac1fb">PPB_FileMapping::Map</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> file_io, int64_t length, uint32_t map_protection, uint32_t map_flags, int64_t offset, void **address, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_mapping__0__1.html#a425d8d5b11de51e8edf539ee13bac1fb" title="Map() maps the contents from an offset of the file into memory.">Map()</a> maps the contents from an offset of the file into memory. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>A <code>PP_Instance</code> identifying one instance of a module. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">file_io</td><td>A <code>PPB_FileIO</code> <code>PP_Resource</code> corresponding to the file that should be mapped in to memory. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>The number of bytes to map. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">map_protection</td><td>A bitfield containing values from <code>PP_FileMapProtection</code>, indicating what memory operations should be permitted on the mapped region. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">map_flags</td><td>A bitfield containing values from <code>PP_FileMapFlags</code>, providing options for the behavior of Map. If the region is to be writeable, then exactly one of <code>PP_FILEMAPFLAG_SHARED</code> or <code>PP_FILEMAPFLAG_PRIVATE</code> must be set. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">offset</td><td>The offset into the file. Must be a multiple of the Map page size as returned by <a class="el" href="struct_p_p_b___file_mapping__0__1.html#ae479690b258985b51dda4d438b8156f0" title="GetMapPageSize() retrieves the size of pages that Map() uses.">GetMapPageSize()</a>. </td></tr>
<tr><td class="paramdir"></td><td class="paramname">inout]</td><td>address The value of <code>*address</code>, if non-NULL, will be used as a hint to determine where in memory the file should be mapped. If the value is NULL, the host operating system will choose <code>address</code>. Upon <a class="el" href="struct_p_p_b___file_mapping__0__1.html#a425d8d5b11de51e8edf539ee13bac1fb" title="Map() maps the contents from an offset of the file into memory.">Map()</a> completing, <code>*address</code> will contain the actual memory location at which the file was mapped. If the plugin provides a non-NULL <code>*address</code>, it must be a multiple of the map page size as returned by <a class="el" href="struct_p_p_b___file_mapping__0__1.html#ae479690b258985b51dda4d438b8156f0" title="GetMapPageSize() retrieves the size of pages that Map() uses.">GetMapPageSize()</a>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>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> to be called upon completion of <a class="el" href="struct_p_p_b___file_mapping__0__1.html#a425d8d5b11de51e8edf539ee13bac1fb" title="Map() maps the contents from an offset of the file into memory.">Map()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a4fa72d6e6660e16ce1ff08453eff172d"></a><!-- doxytag: member="PPB_FileMapping::Unmap" ref="a4fa72d6e6660e16ce1ff08453eff172d" args=")(PP_Instance instance, const void *address, int64_t length, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___file_mapping__0__1.html#a4fa72d6e6660e16ce1ff08453eff172d">PPB_FileMapping::Unmap</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, const void *address, int64_t length, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_b___file_mapping__0__1.html#a4fa72d6e6660e16ce1ff08453eff172d" title="Unmap() deletes the mapping of the specified address.">Unmap()</a> deletes the mapping of the specified address. </p>
<p>The specified address must have been retrieved with <a class="el" href="struct_p_p_b___file_mapping__0__1.html#a425d8d5b11de51e8edf539ee13bac1fb" title="Map() maps the contents from an offset of the file into memory.">Map()</a>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>A <code>PP_Instance</code> identifying the instance. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">address</td><td>The starting address of the address in memory to be unmapped. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>The length of the region to unmap. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>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> to be called upon completion of <a class="el" href="struct_p_p_b___file_mapping__0__1.html#a4fa72d6e6660e16ce1ff08453eff172d" title="Unmap() deletes the mapping of the specified address.">Unmap()</a>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__file__mapping_8h.html">ppb_file_mapping.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}