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

Side by Side Diff: ppapi/c/ppb_file_mapping.h

Issue 69663002: PPAPI: Implement PPB_FileMapping on POSIX (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rough patch. Starting testing. 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
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 /* From dev/ppb_file_io_dev.idl modified Thu Sep 19 10:07:03 2013. */ 6 /* From ppb_file_mapping.idl modified Tue Dec 17 14:05:45 2013. */
7 7
8 #ifndef PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ 8 #ifndef PPAPI_C_PPB_FILE_MAPPING_H_
9 #define PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ 9 #define PPAPI_C_PPB_FILE_MAPPING_H_
10 10
11 #include "ppapi/c/pp_completion_callback.h" 11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/c/pp_macros.h" 13 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_resource.h" 14 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/pp_stdint.h" 15 #include "ppapi/c/pp_stdint.h"
15 16
16 #define PPB_FILEIO_DEV_INTERFACE_0_1 "PPB_FileIO(Dev);0.1" 17 #define PPB_FILEMAPPING_INTERFACE_0_1 "PPB_FileMapping;0.1" /* dev */
17 #define PPB_FILEIO_DEV_INTERFACE PPB_FILEIO_DEV_INTERFACE_0_1
18
19 /** 18 /**
20 * @file 19 * @file
21 * This file defines methods for use with a PPB_FileIO resource that may become 20 * This file defines methods for use with a PPB_FileIO resource that may become
22 * stable in the future. For now, they can be used only in plugins with DEV 21 * stable in the future. For now, they can be used only in plugins with DEV
23 * permissions. 22 * permissions.
24 */ 23 */
25 24
26 25
27 /** 26 /**
28 * @addtogroup Enums 27 * @addtogroup Enums
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileMapFlags, 4); 66 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileMapFlags, 4);
68 /** 67 /**
69 * @} 68 * @}
70 */ 69 */
71 70
72 /** 71 /**
73 * @addtogroup Interfaces 72 * @addtogroup Interfaces
74 * @{ 73 * @{
75 */ 74 */
76 /** 75 /**
77 * PPB_FileIO_Dev contains functions that are usable with PPB_FileIO resources 76 * PPB_FileMapping contains functions that are usable with PPB_FileIO resources
78 * but aren't yet considered stable yet and thus are not supported for general 77 * but aren't yet considered stable yet and thus are not supported for general
79 * NaCl or PNaCl apps yet. Features here are being tested and refined for 78 * NaCl or PNaCl apps yet. Features here are being tested and refined for
80 * possible future inclusion in (stable) PPB_FileIO. 79 * possible future inclusion in (stable) PPB_FileIO.
81 */ 80 */
82 struct PPB_FileIO_Dev_0_1 { 81 struct PPB_FileMapping_0_1 { /* dev */
83 /** 82 /**
84 * Map() maps the contents from an offset of the file into memory. 83 * Map() maps the contents from an offset of the file into memory.
85 * 84 *
86 * @param[in] file_io A PP_Resource corresponding to a file. 85 * @param[in] file_io A PP_Resource corresponding to a file.
87 * @param[in] length The number of bytes to map. 86 * @param[in] length The number of bytes to map.
88 * @param[in] map_protection A bitfield containing values from 87 * @param[in] map_protection A bitfield containing values from
89 * PP_FileMapProtection, indicating what memory operations should be permitted 88 * PP_FileMapProtection, indicating what memory operations should be permitted
90 * on the mapped region. 89 * on the mapped region.
91 * @param[in] map_flags A bitfield containing values from 90 * @param[in] map_flags A bitfield containing values from
92 * PP_FileMapFlags, providing options for the behavior of Map. If the region 91 * PP_FileMapFlags, providing options for the behavior of Map. If the region
93 * is to be writeable, then exactly one of PP_FILEMAPFLAG_SHARED or 92 * is to be writeable, then exactly one of PP_FILEMAPFLAG_SHARED or
94 * PP_FILEMAPFLAG_PRIVATE must be set. 93 * PP_FILEMAPFLAG_PRIVATE must be set.
95 * @param[in] offset The offset into the file. Must be a multiple of the 94 * @param[in] offset The offset into the file. Must be a multiple of the
96 * Map page size as returned by GetMapPageSize. 95 * Map page size as returned by GetMapPageSize.
97 * @param[inout] address The value of |*address|, if non-NULL, will be used as 96 * @param[inout] address The value of |*address|, if non-NULL, will be used as
98 * a hint to determine where in memory the file should be mapped. If the value 97 * a hint to determine where in memory the file should be mapped. If the value
99 * is NULL, the host operating system will choose |address|. Upon 98 * is NULL, the host operating system will choose |address|. Upon
100 * Map() completing, |*address| will contain the actual memory location at 99 * Map() completing, |*address| will contain the actual memory location at
101 * which the file was mapped. If the plugin provides a non-NULL |*address|, it 100 * which the file was mapped. If the plugin provides a non-NULL |*address|, it
102 * must be a multiple of the map page size as returned by GetMapPageSize(). 101 * must be a multiple of the map page size as returned by GetMapPageSize().
103 * @param[in] callback A PP_CompletionCallback to be called upon 102 * @param[in] callback A PP_CompletionCallback to be called upon
104 * completion of Map(). 103 * completion of Map().
105 * 104 *
106 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 105 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
107 */ 106 */
108 int32_t (*Map)(PP_Resource file_io, 107 int32_t (*Map)(PP_Instance instance,
108 PP_Resource file_io,
109 int64_t length, 109 int64_t length,
110 uint32_t map_protection, 110 uint32_t map_protection,
111 uint32_t map_flags, 111 uint32_t map_flags,
112 int64_t offset, 112 int64_t offset,
113 void** address, 113 void** address,
114 struct PP_CompletionCallback callback); 114 struct PP_CompletionCallback callback);
115 /** 115 /**
116 * Unmap() deletes the mapping of the specified address address to a 116 * Unmap() deletes the mapping of the specified address. The specified
117 * file io. The specified address must have been retrieved with 117 * address must have been retrieved with Map().
118 * Map(). 118 * @param[in] instance A <code>PP_Instance</code> identifying the instance.
119 * @param[in] file_io A PP_Resource corresponding to a file.
120 * @param[in] address The starting address of the address in memory to 119 * @param[in] address The starting address of the address in memory to
121 * be unmapped. 120 * be unmapped.
122 * @param[in] length The length of the region to unmap. 121 * @param[in] length The length of the region to unmap.
123 */ 122 */
124 void (*Unmap)(PP_Resource file_io, void* address, int64_t length); 123 void (*Unmap)(PP_Instance file_io, void* address, int64_t length);
125 /** 124 /**
126 * GetMapPageSize() returns the size of pages that Map() uses. Returns 0 on 125 * GetMapPageSize() returns the size of pages that Map() uses. Returns 0 on
127 * failure. 126 * failure.
127 * @param[in] instance A <code>PP_Instance</code> identifying the instance.
128 */ 128 */
129 int64_t (*GetMapPageSize)(PP_Resource file_io); 129 int64_t (*GetMapPageSize)(PP_Instance file_io);
130 }; 130 };
131
132 typedef struct PPB_FileIO_Dev_0_1 PPB_FileIO_Dev;
133 /** 131 /**
134 * @} 132 * @}
135 */ 133 */
136 134
137 #endif /* PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ */ 135 #endif /* PPAPI_C_PPB_FILE_MAPPING_H_ */
138 136
OLDNEW
« no previous file with comments | « ppapi/c/dev/ppb_file_io_dev.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698