Chromium Code Reviews| Index: services/files/file.mojom |
| diff --git a/services/files/file.mojom b/services/files/file.mojom |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..43f1b4b129e59cd59ce7e4111ef0f6e02f0f3e91 |
| --- /dev/null |
| +++ b/services/files/file.mojom |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// TODO(vtl): notes to self: |
| +// - file offsets, file positions, and file sizes are int64 (though positions |
| +// and sizes must always be non-negative) |
| +// - buffer size parameters (for read/write) are uint32 |
| + |
| +module mojo.files; |
| + |
| +import "services/files/types.mojom"; |
| + |
| +// TODO(vtl): Write comments. |
| +interface File { |
| + Close() => (Error err); |
|
qsr
2015/03/02 12:46:40
What can you do with a connected closed file? If n
viettrungluu
2015/03/02 18:10:59
Not very much.
qsr
2015/03/03 11:56:44
Ok
viettrungluu
2015/03/03 18:50:35
I meant that it's similar in effect to closing the
|
| + |
| + Read(uint32 num_bytes_to_read, int64 offset, Whence whence) |
| + => (Error error, array<uint8>? bytes_read); |
| + Write(array<uint8> bytes_to_write, int64 offset, Whence whence) |
| + => (Error error, uint32 num_bytes_written); |
| + |
| + // TODO(vtl): We definitely want 64 bits for |num_bytes_to_read|; but do we |
| + // want it to be signed (this is consistent with |size| values, but |
| + // inconsistent with 32-bit |num_bytes_to_read| values)? Do we want to have |
| + // separate "read to end" versus "tail" (i.e., keep on reading as more data is |
| + // appended) modes, and how would those be signalled? |
|
qsr
2015/03/02 12:46:40
Do you also need a special value of no limit?
viettrungluu
2015/03/02 18:10:59
See TODO above -- we need TWO special values!
|
| + ReadToStream(handle<data_pipe_producer> source, |
| + int64 offset, |
| + Whence whence, |
| + int64 num_bytes_to_read) => (Error error); |
| + WriteFromStream(handle<data_pipe_consumer> sink, int64 offset, Whence whence) |
| + => (Error error); |
| + |
| + Tell() => (Error error, int64 position); |
| + Seek(int64 offset, Whence whence) => (Error error, int64 position); |
| + |
| + Stat() => (Error error, FileInformation? file_information); |
| + Truncate(int64 size) => (Error error); |
| + // TODO(vtl): null |times| means "now" (for both atime and mtime). |
|
qsr
2015/03/02 12:46:40
Isn't the comment outdated? You have way to specif
viettrungluu
2015/03/02 18:10:59
Done.
|
| + Touch(TimespecOrNow? atime, TimespecOrNow? mtime) => (Error error); |
| + |
| + // TODO(vtl): |Dup()| shares the same file description (i.e., mode and |
| + // position). |
| + Dup(File& file) => (Error error); |
| + // TODO(vtl): What are the rules for reopening (w.r.t. changing mode/flags). |
| + // E.g., obviously can go from "read-write" to "read", but reverse? (probably |
| + // not), can remove "append"? (probably not?). Do we allow "truncate"? |
| + Reopen(File& file, uint32 open_flags) => (Error error); |
| + |
| + // TODO(vtl): probably should have access flags (but also exec?); how do these |
| + // relate to access mode? |
| + AsBuffer() => (Error error, handle<shared_buffer>? buffer); |
| + |
| + // TODO(vtl): Add a "watch"? |
| +}; |