OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SERVICES_FILES_C_LIB_FILE_FD_IMPL_H_ | 5 #ifndef SERVICES_FILES_C_LIB_FILE_FD_IMPL_H_ |
6 #define SERVICES_FILES_C_LIB_FILE_FD_IMPL_H_ | 6 #define SERVICES_FILES_C_LIB_FILE_FD_IMPL_H_ |
7 | 7 |
8 #include "files/c/lib/fd_impl.h" | 8 #include "files/c/lib/fd_impl.h" |
9 #include "files/c/mojio_sys_types.h" | 9 #include "files/c/mojio_sys_types.h" |
10 #include "files/interfaces/file.mojom-sync.h" | 10 #include "files/interfaces/file.mojom-sync.h" |
11 #include "mojo/public/c/system/macros.h" | |
12 #include "mojo/public/cpp/bindings/interface_handle.h" | 11 #include "mojo/public/cpp/bindings/interface_handle.h" |
13 #include "mojo/public/cpp/bindings/synchronous_interface_ptr.h" | 12 #include "mojo/public/cpp/bindings/synchronous_interface_ptr.h" |
| 13 #include "mojo/public/cpp/system/macros.h" |
14 | 14 |
15 namespace mojio { | 15 namespace mojio { |
16 | 16 |
17 class FileFDImpl : public FDImpl { | 17 class FileFDImpl : public FDImpl { |
18 public: | 18 public: |
19 FileFDImpl(ErrnoImpl* errno_impl, | 19 FileFDImpl(ErrnoImpl* errno_impl, |
20 mojo::InterfaceHandle<mojo::files::File> file); | 20 mojo::InterfaceHandle<mojo::files::File> file); |
21 ~FileFDImpl() override; | 21 ~FileFDImpl() override; |
22 | 22 |
23 // |FDImpl| implementation: | 23 // |FDImpl| implementation: |
24 bool Close() override; | 24 bool Close() override; |
25 std::unique_ptr<FDImpl> Dup() override; | 25 std::unique_ptr<FDImpl> Dup() override; |
26 bool Ftruncate(mojio_off_t length) override; | 26 bool Ftruncate(mojio_off_t length) override; |
27 mojio_off_t Lseek(mojio_off_t offset, int whence) override; | 27 mojio_off_t Lseek(mojio_off_t offset, int whence) override; |
28 mojio_ssize_t Read(void* buf, size_t count) override; | 28 mojio_ssize_t Read(void* buf, size_t count) override; |
29 mojio_ssize_t Write(const void* buf, size_t count) override; | 29 mojio_ssize_t Write(const void* buf, size_t count) override; |
30 bool Fstat(struct mojio_stat* buf) override; | 30 bool Fstat(struct mojio_stat* buf) override; |
31 | 31 |
32 private: | 32 private: |
33 mojo::SynchronousInterfacePtr<mojo::files::File> file_; | 33 mojo::SynchronousInterfacePtr<mojo::files::File> file_; |
34 | 34 |
35 MOJO_DISALLOW_COPY_AND_ASSIGN(FileFDImpl); | 35 MOJO_DISALLOW_COPY_AND_ASSIGN(FileFDImpl); |
36 }; | 36 }; |
37 | 37 |
38 } // namespace mojio | 38 } // namespace mojio |
39 | 39 |
40 #endif // SERVICES_FILES_C_LIB_FILE_FD_IMPL_H_ | 40 #endif // SERVICES_FILES_C_LIB_FILE_FD_IMPL_H_ |
OLD | NEW |