OLD | NEW |
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 #ifndef PPAPI_C_PPB_FILE_IO_H_ | 5 #ifndef PPAPI_C_PPB_FILE_IO_H_ |
6 #define PPAPI_C_PPB_FILE_IO_H_ | 6 #define PPAPI_C_PPB_FILE_IO_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_macros.h" | 10 #include "ppapi/c/pp_macros.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // regular file. PP_FILEOPENFLAG_WRITE must also be specified. | 32 // regular file. PP_FILEOPENFLAG_WRITE must also be specified. |
33 PP_FILEOPENFLAG_TRUNCATE = 1 << 3, | 33 PP_FILEOPENFLAG_TRUNCATE = 1 << 3, |
34 | 34 |
35 // Requests that the file is created when this flag is combined with | 35 // Requests that the file is created when this flag is combined with |
36 // PP_FILEOPENFLAG_CREATE. If this flag is specified, and the file already | 36 // PP_FILEOPENFLAG_CREATE. If this flag is specified, and the file already |
37 // exists, then the FileIO::Open call will fail. | 37 // exists, then the FileIO::Open call will fail. |
38 PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4 | 38 PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4 |
39 } PP_FileOpenFlags; | 39 } PP_FileOpenFlags; |
40 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileOpenFlags, 4); | 40 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileOpenFlags, 4); |
41 | 41 |
42 #define PPB_FILEIO_INTERFACE_0_4 "PPB_FileIO;0.4" | 42 #define PPB_FILEIO_INTERFACE_0_5 "PPB_FileIO;0.5" |
43 #define PPB_FILEIO_INTERFACE PPB_FILEIO_INTERFACE_0_4 | 43 #define PPB_FILEIO_INTERFACE PPB_FILEIO_INTERFACE_0_5 |
44 | 44 |
45 // Use this interface to operate on a regular file (PP_FileType_Regular). | 45 // Use this interface to operate on a regular file (PP_FileType_Regular). |
46 struct PPB_FileIO { | 46 struct PPB_FileIO { |
47 // Creates a new FileIO object. Returns 0 if the module is invalid. | 47 // Creates a new FileIO object. Returns 0 if the module is invalid. |
48 PP_Resource (*Create)(PP_Instance instance); | 48 PP_Resource (*Create)(PP_Instance instance); |
49 | 49 |
50 // Returns PP_TRUE if the given resource is a FileIO. Returns PP_FALSE if the | 50 // Returns PP_TRUE if the given resource is a FileIO. Returns PP_FALSE if the |
51 // resource is invalid or some type other than a FileIO. | 51 // resource is invalid or some type other than a FileIO. |
52 PP_Bool (*IsFileIO)(PP_Resource resource); | 52 PP_Bool (*IsFileIO)(PP_Resource resource); |
53 | 53 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Cancels any IO that may be pending, and closes the FileIO object. Any | 110 // Cancels any IO that may be pending, and closes the FileIO object. Any |
111 // pending callbacks will still run, reporting PP_Error_Aborted if pending IO | 111 // pending callbacks will still run, reporting PP_Error_Aborted if pending IO |
112 // was interrupted. It is NOT valid to call Open again after a call to this | 112 // was interrupted. It is NOT valid to call Open again after a call to this |
113 // method. Note: If the FileIO object is destroyed, and it is still open, | 113 // method. Note: If the FileIO object is destroyed, and it is still open, |
114 // then it will be implicitly closed, so you are not required to call the | 114 // then it will be implicitly closed, so you are not required to call the |
115 // Close method. | 115 // Close method. |
116 void (*Close)(PP_Resource file_io); | 116 void (*Close)(PP_Resource file_io); |
117 }; | 117 }; |
118 | 118 |
119 #endif /* PPAPI_C_PPB_FILE_IO_H_ */ | 119 #endif /* PPAPI_C_PPB_FILE_IO_H_ */ |
| 120 |
OLD | NEW |