Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: ppapi/api/ppb_file_mapping.idl

Issue 69663002: PPAPI: Implement PPB_FileMapping on POSIX (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build? Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Copyright (c) 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 */
5
6
7 /**
8 * This file defines methods for mapping and unmapping files into and out of
9 * memory.
10 */
11
12 [generate_thunk]
13
14 label Chrome {
15 [channel=dev] M34 = 0.1
16 };
17
18 /**
19 * The PP_FileMapProtection values indicate the permissions requested for the
20 * file mapping. These should be used in a uint32_t bitfield.
21 */
22 [assert_size(4)]
23 enum PP_FileMapProtection {
24 /** Requests read access to the mapped address. */
25 PP_FILEMAPPROTECTION_READ = 1u << 0,
26
27 /** Requests write access to the mapped address. */
28 PP_FILEMAPPROTECTION_WRITE = 1u << 1
29 };
30
31 /**
32 * The PP_FileMapFlags contain flag values for use with Map().
33 */
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.
42 */
43 PP_FILEMAPFLAG_SHARED = 1u << 0,
44
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).
49 */
50 PP_FILEMAPFLAG_PRIVATE = 1u << 1,
51
52 /**
53 * Forces Map() to map the file contents at the provided |address|. If Map()
54 * can not comply, Map() will fail.
55 */
56 PP_FILEMAPFLAG_FIXED = 1u << 2
57 };
58
59 /**
60 * PPB_FileMapping contains functions for mapping and unmapping files into and
61 * out of memory.
62 */
63 [singleton]
64 interface PPB_FileMapping {
65 /**
66 * Map() maps the contents from an offset of the file into memory.
67 *
68 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
69 * a module.
70 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file.
71 * @param[in] length The number of bytes to map.
72 * @param[in] map_protection A bitfield containing values from
73 * <code>PP_FileMapProtection</code>, indicating what memory operations
74 * should be permitted on the mapped region.
75 * @param[in] map_flags A bitfield containing values from
76 * <code>PP_FileMapFlags</code>, providing options for the behavior of Map.
77 * If the region is to be writeable, then exactly one of
78 * <code>PP_FILEMAPFLAG_SHARED</code> or <code>PP_FILEMAPFLAG_PRIVATE</code>
79 * must be set.
80 * @param[in] offset The offset into the file. Must be a multiple of the
81 * Map page size as returned by GetMapPageSize().
82 * @param[inout] address The value of <code>*address</code>, if non-NULL,
83 * will be used as a hint to determine where in memory the file should be
84 * mapped. If the value is NULL, the host operating system will choose
85 * <code>address</code>. Upon Map() completing, <code>*address</code> will
86 * contain the actual memory location at which the file was mapped. If the
87 * plugin provides a non-NULL <code>*address</code>, it must be a multiple of
88 * the map page size as returned by GetMapPageSize().
89 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
90 * completion of Map().
91 *
92 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
93 */
94 int32_t Map([in] PP_Instance instance,
95 [in] PP_Resource file_io,
96 [in] int64_t length,
97 [in] uint32_t map_protection,
98 [in] uint32_t map_flags,
99 [in] int64_t offset,
100 [inout] mem_ptr_t address,
101 [in] PP_CompletionCallback callback);
102
103 /**
104 * Unmap() deletes the mapping of the specified address. The specified
105 * address must have been retrieved with Map().
106 * @param[in] instance A <code>PP_Instance</code> identifying the instance.
107 * @param[in] address The starting address of the address in memory to
108 * be unmapped.
109 * @param[in] length The length of the region to unmap.
110 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
111 * completion of Unmap().
112 *
113 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
114 */
115 int32_t Unmap([in] PP_Instance instance,
116 [in] mem_t address,
117 [in] int64_t length,
118 [in] PP_CompletionCallback callback);
119
120 /**
121 * GetMapPageSize() retrieves the size of pages that Map() uses.
122 *
123 * @param[in] instance A <code>PP_Instance</code> identifying the instance.
124 *
125 * @return The size of pages that Map() uses. Returns 0 on failure.
126 */
127 [on_failure=0]
128 int64_t GetMapPageSize(PP_Instance instance);
129 };
130
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698