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