OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DEV_PPB_FILE_IO_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_macros.h" |
9 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
10 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
12 #include "ppapi/c/pp_time.h" | 13 #include "ppapi/c/pp_time.h" |
13 | 14 |
14 struct PP_CompletionCallback; | 15 struct PP_CompletionCallback; |
15 struct PP_FileInfo_Dev; | 16 struct PP_FileInfo_Dev; |
16 | 17 |
17 typedef enum { | 18 typedef enum { |
18 // Requests read access to a file. | 19 // Requests read access to a file. |
(...skipping 10 matching lines...) Expand all Loading... |
29 | 30 |
30 // Requests that the file be truncated to length 0 if it exists and is a | 31 // Requests that the file be truncated to length 0 if it exists and is a |
31 // regular file. PP_FILEOPENFLAG_WRITE must also be specified. | 32 // regular file. PP_FILEOPENFLAG_WRITE must also be specified. |
32 PP_FILEOPENFLAG_TRUNCATE = 1 << 3, | 33 PP_FILEOPENFLAG_TRUNCATE = 1 << 3, |
33 | 34 |
34 // 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 |
35 // 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 |
36 // exists, then the FileIO::Open call will fail. | 37 // exists, then the FileIO::Open call will fail. |
37 PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4 | 38 PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4 |
38 } PP_FileOpenFlags_Dev; | 39 } PP_FileOpenFlags_Dev; |
| 40 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileOpenFlags_Dev, 4); |
39 | 41 |
40 #define PPB_FILEIO_DEV_INTERFACE "PPB_FileIO(Dev);0.2" | 42 #define PPB_FILEIO_DEV_INTERFACE "PPB_FileIO(Dev);0.2" |
41 | 43 |
42 // Use this interface to operate on a regular file (PP_FileType_Regular). | 44 // Use this interface to operate on a regular file (PP_FileType_Regular). |
43 struct PPB_FileIO_Dev { | 45 struct PPB_FileIO_Dev { |
44 // Creates a new FileIO object. Returns 0 if the module is invalid. | 46 // Creates a new FileIO object. Returns 0 if the module is invalid. |
45 PP_Resource (*Create)(PP_Module module); | 47 PP_Resource (*Create)(PP_Module module); |
46 | 48 |
47 // Returns PP_TRUE if the given resource is a FileIO. Returns PP_FALSE if the | 49 // Returns PP_TRUE if the given resource is a FileIO. Returns PP_FALSE if the |
48 // resource is invalid or some type other than a FileIO. | 50 // resource is invalid or some type other than a FileIO. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Cancels any IO that may be pending, and closes the FileIO object. Any | 109 // Cancels any IO that may be pending, and closes the FileIO object. Any |
108 // pending callbacks will still run, reporting PP_Error_Aborted if pending IO | 110 // pending callbacks will still run, reporting PP_Error_Aborted if pending IO |
109 // was interrupted. It is NOT valid to call Open again after a call to this | 111 // was interrupted. It is NOT valid to call Open again after a call to this |
110 // method. Note: If the FileIO object is destroyed, and it is still open, | 112 // method. Note: If the FileIO object is destroyed, and it is still open, |
111 // then it will be implicitly closed, so you are not required to call the | 113 // then it will be implicitly closed, so you are not required to call the |
112 // Close method. | 114 // Close method. |
113 void (*Close)(PP_Resource file_io); | 115 void (*Close)(PP_Resource file_io); |
114 }; | 116 }; |
115 | 117 |
116 #endif // PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ | 118 #endif // PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ |
OLD | NEW |