Roll leveldb from r73 to r75.
[chromium-blink-merge.git] / ppapi / c / trusted / ppb_file_io_trusted.h
blob8e05589eeb621c09b7a89d6ad67efbf72ce07a0b
1 /* Copyright (c) 2012 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 */
6 /* From trusted/ppb_file_io_trusted.idl modified Wed Mar 27 14:50:12 2013. */
8 #ifndef PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_
9 #define PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_
11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/pp_stdint.h"
16 #define PPB_FILEIOTRUSTED_INTERFACE_0_4 "PPB_FileIOTrusted;0.4"
17 #define PPB_FILEIOTRUSTED_INTERFACE PPB_FILEIOTRUSTED_INTERFACE_0_4
19 /**
20 * @file
22 * This file defines the trusted file IO interface
26 /**
27 * @addtogroup Interfaces
28 * @{
30 /* Available only to trusted implementations. */
31 struct PPB_FileIOTrusted_0_4 {
32 /**
33 * Returns a file descriptor corresponding to the given FileIO object. On
34 * Windows, returns a HANDLE; on all other platforms, returns a POSIX file
35 * descriptor. The FileIO object must have been opened with a successful
36 * call to FileIO::Open. The file descriptor will be closed automatically
37 * when the FileIO object is closed or destroyed.
39 * TODO(hamaji): Remove this and use RequestOSFileHandle instead.
41 int32_t (*GetOSFileDescriptor)(PP_Resource file_io);
42 /**
43 * Notifies the browser that underlying file will be modified. This gives
44 * the browser the opportunity to apply quota restrictions and possibly
45 * return an error to indicate that the write is not allowed.
47 int32_t (*WillWrite)(PP_Resource file_io,
48 int64_t offset,
49 int32_t bytes_to_write,
50 struct PP_CompletionCallback callback);
51 /**
52 * Notifies the browser that underlying file will be modified. This gives
53 * the browser the opportunity to apply quota restrictions and possibly
54 * return an error to indicate that the write is not allowed.
56 * TODO(darin): Maybe unify the above into a single WillChangeFileSize
57 * method? The above methods have the advantage of mapping to PPB_FileIO
58 * Write and SetLength calls. WillChangeFileSize would require the caller to
59 * compute the file size resulting from a Write call, which may be
60 * undesirable.
62 int32_t (*WillSetLength)(PP_Resource file_io,
63 int64_t length,
64 struct PP_CompletionCallback callback);
67 typedef struct PPB_FileIOTrusted_0_4 PPB_FileIOTrusted;
68 /**
69 * @}
72 #endif /* PPAPI_C_TRUSTED_PPB_FILE_IO_TRUSTED_H_ */