| Index: components/filesystem/public/interfaces/file.mojom
|
| diff --git a/components/filesystem/public/interfaces/file.mojom b/components/filesystem/public/interfaces/file.mojom
|
| index 6ef7067690235083499b09886c5f6d25494a24f0..05bce45cbf2b2db5076f8fd9f6ff7dac0729f322 100644
|
| --- a/components/filesystem/public/interfaces/file.mojom
|
| +++ b/components/filesystem/public/interfaces/file.mojom
|
| @@ -16,6 +16,7 @@ interface File {
|
| // Flushes/closes this file; no operations may be performed on this file after
|
| // this. Note that any error code is strictly informational -- the close may
|
| // not be retried.
|
| + [Sync]
|
| Close() => (FileError err);
|
|
|
| // Reads (at most) |num_bytes_to_read| from the location specified by
|
| @@ -24,42 +25,51 @@ interface File {
|
| // are read.
|
| // TODO(vtl): Clarify when (for what values of |offset|/|whence|) this
|
| // modifies the file position. Or maybe there should be a flag?
|
| + [Sync]
|
| Read(uint32 num_bytes_to_read, int64 offset, Whence whence)
|
| => (FileError error, array<uint8>? bytes_read);
|
|
|
| // Writes |bytes_to_write| to the location specified by |offset|/|whence|.
|
| // TODO(vtl): Clarify behavior when |num_bytes_written| is less than the size
|
| // of |bytes_to_write|.
|
| + [Sync]
|
| Write(array<uint8> bytes_to_write, int64 offset, Whence whence)
|
| => (FileError error, uint32 num_bytes_written);
|
|
|
| // Gets the current file position. On success, |position| is the current
|
| // offset (in bytes) from the beginning of the file).
|
| + [Sync]
|
| Tell() => (FileError error, int64 position);
|
|
|
| // Sets the current file position to that specified by |offset|/|whence|. On
|
| // success, |position| is the offset (in bytes) from the beginning of the
|
| // file.
|
| + [Sync]
|
| Seek(int64 offset, Whence whence) => (FileError error, int64 position);
|
|
|
| // Gets information about this file. On success, |file_information| is
|
| // non-null and will contain this information.
|
| + [Sync]
|
| Stat() => (FileError error, FileInformation? file_information);
|
|
|
| // Truncates this file to the size specified by |size| (in bytes).
|
| + [Sync]
|
| Truncate(int64 size) => (FileError error);
|
|
|
| // Updates this file's atime and/or mtime to the time specified by |atime| (or
|
| // |mtime|, respectively), which may also indicate "now". If |atime| or
|
| // |mtime| is null, then the corresponding time is not modified.
|
| + [Sync]
|
| Touch(TimespecOrNow? atime, TimespecOrNow? mtime) => (FileError error);
|
|
|
| // Creates a new |File| instance, which shares the same "file description".
|
| // I.e., the access mode, etc. (as specified to |Directory::OpenFile()| by the
|
| // |open_flags| argument) as well as file position.
|
| + [Sync]
|
| Dup(File& file) => (FileError error);
|
|
|
| // Syncs data to disk.
|
| + [Sync]
|
| Flush() => (FileError error);
|
|
|
| // Attempts to take an exclusive write lock on the file. This both takes a
|
| @@ -73,5 +83,6 @@ interface File {
|
| Unlock() => (FileError error);
|
|
|
| // Returns a handle to the file for raw access.
|
| + [Sync]
|
| AsHandle() => (FileError error, handle file_handle);
|
| };
|
|
|