{{+bindTo:partials.standard_nacl_api}}

PPB_FileMapping Struct Reference

{{- dummy div to appease doxygen -}}

Data Fields

int32_t(* Map )(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)
int32_t(* Unmap )(PP_Instance instance, const void *address, int64_t length, struct PP_CompletionCallback callback)
int64_t(* GetMapPageSize )(PP_Instance instance)

Detailed Description

PPB_FileMapping contains functions for mapping and unmapping files into and out of memory.


Field Documentation

GetMapPageSize() retrieves the size of pages that Map() uses.

Parameters:
[in]instanceA PP_Instance identifying the instance.
Returns:
The size of pages that Map() uses. Returns 0 on failure.
int32_t(* PPB_FileMapping::Map)(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)

Map() maps the contents from an offset of the file into memory.

Parameters:
[in]instanceA PP_Instance identifying one instance of a module.
[in]file_ioA PPB_FileIO PP_Resource corresponding to the file that should be mapped in to memory.
[in]lengthThe number of bytes to map.
[in]map_protectionA bitfield containing values from PP_FileMapProtection, indicating what memory operations should be permitted on the mapped region.
[in]map_flagsA bitfield containing values from PP_FileMapFlags, providing options for the behavior of Map. If the region is to be writeable, then exactly one of PP_FILEMAPFLAG_SHARED or PP_FILEMAPFLAG_PRIVATE must be set.
[in]offsetThe offset into the file. Must be a multiple of the Map page size as returned by GetMapPageSize().
inout]address The value of *address, 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 address. Upon Map() completing, *address will contain the actual memory location at which the file was mapped. If the plugin provides a non-NULL *address, it must be a multiple of the map page size as returned by GetMapPageSize().
[in]callbackA PP_CompletionCallback to be called upon completion of Map().
Returns:
An int32_t containing an error code from pp_errors.h.
int32_t(* PPB_FileMapping::Unmap)(PP_Instance instance, const void *address, int64_t length, struct PP_CompletionCallback callback)

Unmap() deletes the mapping of the specified address.

The specified address must have been retrieved with Map().

Parameters:
[in]instanceA PP_Instance identifying the instance.
[in]addressThe starting address of the address in memory to be unmapped.
[in]lengthThe length of the region to unmap.
[in]callbackA PP_CompletionCallback to be called upon completion of Unmap().
Returns:
An int32_t containing an error code from pp_errors.h.

The documentation for this struct was generated from the following file:
{{/partials.standard_nacl_api}}