Move render_view_context_menu.* and related files out of tab_contents.
[chromium-blink-merge.git] / ppapi / api / ppb_file_mapping.idl
blob7037955d34377f6caccb6f8082f481aee99c7472
1 /* Copyright 2014 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
7 /**
8 * This file defines methods for mapping and unmapping files into and out of
9 * memory.
12 [generate_thunk]
14 label Chrome {
15 [channel=dev] M34 = 0.1
18 /**
19 * The PP_FileMapProtection values indicate the permissions requested for the
20 * file mapping. These should be used in a uint32_t bitfield.
22 [assert_size(4)]
23 enum PP_FileMapProtection {
24 /** Requests read access to the mapped address. */
25 PP_FILEMAPPROTECTION_READ = 1u << 0,
27 /** Requests write access to the mapped address. */
28 PP_FILEMAPPROTECTION_WRITE = 1u << 1
31 /**
32 * The PP_FileMapFlags contain flag values for use with Map().
34 [assert_size(4)]
35 enum PP_FileMapFlags {
36 /**
37 * Requests a shared mapping. If this flag is set, changes written to the
38 * memory region will be reflected in the underlying file and will thus
39 * eventually be visible to other processes which have opened the file. The
40 * file may not actually be updated until Unmap() is called. This is only
41 * valid if the PPB_FileIO resource was opened with write permission.
43 PP_FILEMAPFLAG_SHARED = 1u << 0,
45 /**
46 * Requests a copy-on-write mapping. If this flag is set, changes are not
47 * written to the underlying file, but only in the memory of the process
48 * (copy-on-write).
50 PP_FILEMAPFLAG_PRIVATE = 1u << 1,
52 /**
53 * Forces Map() to map the file contents at the provided |address|. If Map()
54 * can not comply, Map() will fail.
56 PP_FILEMAPFLAG_FIXED = 1u << 2
59 /**
60 * PPB_FileMapping contains functions for mapping and unmapping files into and
61 * out of memory.
63 [singleton]
64 interface PPB_FileMapping {
65 /**
66 * Map() maps the contents from an offset of the file into memory.
68 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
69 * a module.
70 * @param[in] file_io A <code>PPB_FileIO</code> <code>PP_Resource</code>
71 * corresponding to the file that should be mapped in to memory.
72 * @param[in] length The number of bytes to map.
73 * @param[in] map_protection A bitfield containing values from
74 * <code>PP_FileMapProtection</code>, indicating what memory operations
75 * should be permitted on the mapped region.
76 * @param[in] map_flags A bitfield containing values from
77 * <code>PP_FileMapFlags</code>, providing options for the behavior of Map.
78 * If the region is to be writeable, then exactly one of
79 * <code>PP_FILEMAPFLAG_SHARED</code> or <code>PP_FILEMAPFLAG_PRIVATE</code>
80 * must be set.
81 * @param[in] offset The offset into the file. Must be a multiple of the
82 * Map page size as returned by GetMapPageSize().
83 * @param[inout] address The value of <code>*address</code>, if non-NULL,
84 * will be used as a hint to determine where in memory the file should be
85 * mapped. If the value is NULL, the host operating system will choose
86 * <code>address</code>. Upon Map() completing, <code>*address</code> will
87 * contain the actual memory location at which the file was mapped. If the
88 * plugin provides a non-NULL <code>*address</code>, it must be a multiple of
89 * the map page size as returned by GetMapPageSize().
90 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
91 * completion of Map().
93 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
95 int32_t Map([in] PP_Instance instance,
96 [in] PP_Resource file_io,
97 [in] int64_t length,
98 [in] uint32_t map_protection,
99 [in] uint32_t map_flags,
100 [in] int64_t offset,
101 [inout] mem_ptr_t address,
102 [in] PP_CompletionCallback callback);
105 * Unmap() deletes the mapping of the specified address. The specified
106 * address must have been retrieved with Map().
107 * @param[in] instance A <code>PP_Instance</code> identifying the instance.
108 * @param[in] address The starting address of the address in memory to
109 * be unmapped.
110 * @param[in] length The length of the region to unmap.
111 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
112 * completion of Unmap().
114 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
116 int32_t Unmap([in] PP_Instance instance,
117 [in] mem_t address,
118 [in] int64_t length,
119 [in] PP_CompletionCallback callback);
122 * GetMapPageSize() retrieves the size of pages that Map() uses.
124 * @param[in] instance A <code>PP_Instance</code> identifying the instance.
126 * @return The size of pages that Map() uses. Returns 0 on failure.
128 [on_failure=0]
129 int64_t GetMapPageSize(PP_Instance instance);