| 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 COMPONENTS_FILESYSTEM_FILE_IMPL_H_ | 5 #ifndef COMPONENTS_FILESYSTEM_FILE_IMPL_H_ |
| 6 #define COMPONENTS_FILESYSTEM_FILE_IMPL_H_ | 6 #define COMPONENTS_FILESYSTEM_FILE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 11 #include "base/files/scoped_file.h" | 11 #include "base/files/scoped_file.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/filesystem/public/interfaces/directory.mojom.h" | 13 #include "components/filesystem/public/interfaces/directory.mojom.h" |
| 14 #include "mojo/public/cpp/bindings/interface_request.h" | 14 #include "mojo/public/cpp/bindings/interface_request.h" |
| 15 #include "mojo/public/cpp/bindings/strong_binding.h" | 15 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class FilePath; | 18 class FilePath; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace filesystem { | 21 namespace filesystem { |
| 22 | 22 |
| 23 class LockTable; | 23 class LockTable; |
| 24 class SharedTempDir; |
| 24 | 25 |
| 25 class FileImpl : public File { | 26 class FileImpl : public File { |
| 26 public: | 27 public: |
| 27 FileImpl(mojo::InterfaceRequest<File> request, | 28 FileImpl(mojo::InterfaceRequest<File> request, |
| 28 const base::FilePath& path, | 29 const base::FilePath& path, |
| 29 uint32_t flags, | 30 uint32_t flags, |
| 31 scoped_refptr<SharedTempDir> temp_dir, |
| 30 scoped_refptr<LockTable> lock_table); | 32 scoped_refptr<LockTable> lock_table); |
| 31 FileImpl(mojo::InterfaceRequest<File> request, | 33 FileImpl(mojo::InterfaceRequest<File> request, |
| 32 const base::FilePath& path, | 34 const base::FilePath& path, |
| 33 base::File file, | 35 base::File file, |
| 36 scoped_refptr<SharedTempDir> temp_dir, |
| 34 scoped_refptr<LockTable> lock_table); | 37 scoped_refptr<LockTable> lock_table); |
| 35 ~FileImpl() override; | 38 ~FileImpl() override; |
| 36 | 39 |
| 37 // Returns whether the underlying file handle is valid. | 40 // Returns whether the underlying file handle is valid. |
| 38 bool IsValid() const; | 41 bool IsValid() const; |
| 39 | 42 |
| 40 // Attempts to perform the native operating system's locking operations on | 43 // Attempts to perform the native operating system's locking operations on |
| 41 // the internal File handle | 44 // the internal File handle |
| 42 base::File::Error RawLockFile(); | 45 base::File::Error RawLockFile(); |
| 43 base::File::Error RawUnlockFile(); | 46 base::File::Error RawUnlockFile(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 const DupCallback& callback) override; | 70 const DupCallback& callback) override; |
| 68 void Flush(const FlushCallback& callback) override; | 71 void Flush(const FlushCallback& callback) override; |
| 69 void Lock(const LockCallback& callback) override; | 72 void Lock(const LockCallback& callback) override; |
| 70 void Unlock(const UnlockCallback& callback) override; | 73 void Unlock(const UnlockCallback& callback) override; |
| 71 void AsHandle(const AsHandleCallback& callback) override; | 74 void AsHandle(const AsHandleCallback& callback) override; |
| 72 | 75 |
| 73 private: | 76 private: |
| 74 mojo::StrongBinding<File> binding_; | 77 mojo::StrongBinding<File> binding_; |
| 75 base::File file_; | 78 base::File file_; |
| 76 base::FilePath path_; | 79 base::FilePath path_; |
| 80 scoped_refptr<SharedTempDir> temp_dir_; |
| 77 scoped_refptr<LockTable> lock_table_; | 81 scoped_refptr<LockTable> lock_table_; |
| 78 | 82 |
| 79 DISALLOW_COPY_AND_ASSIGN(FileImpl); | 83 DISALLOW_COPY_AND_ASSIGN(FileImpl); |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 } // namespace filesystem | 86 } // namespace filesystem |
| 83 | 87 |
| 84 #endif // COMPONENTS_FILESYSTEM_FILE_IMPL_H_ | 88 #endif // COMPONENTS_FILESYSTEM_FILE_IMPL_H_ |
| OLD | NEW |