Chromium Code Reviews| 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 | 24 |
| 25 class FileImpl : public File { | 25 class FileImpl : public File { |
| 26 public: | 26 public: |
| 27 FileImpl(mojo::InterfaceRequest<File> request, | 27 FileImpl(mojo::InterfaceRequest<File> request, |
| 28 const base::FilePath& path, | 28 const base::FilePath& path, |
| 29 uint32_t flags, | 29 uint32_t flags, |
| 30 LockTable* lock_table); | 30 const scoped_refptr<LockTable>& lock_table); |
| 31 FileImpl(mojo::InterfaceRequest<File> request, | 31 FileImpl(mojo::InterfaceRequest<File> request, |
| 32 const base::FilePath& path, | 32 const base::FilePath& path, |
| 33 base::File file, | 33 base::File file, |
| 34 LockTable* lock_table); | 34 const scoped_refptr<LockTable>& lock_table); |
|
michaeln
2016/03/17 22:35:41
ditto smartptr passing mavens by scoped_refptr<> v
| |
| 35 ~FileImpl() override; | 35 ~FileImpl() override; |
| 36 | 36 |
| 37 // Returns whether the underlying file handle is valid. | 37 // Returns whether the underlying file handle is valid. |
| 38 bool IsValid() const; | 38 bool IsValid() const; |
| 39 | 39 |
| 40 // Attempts to perform the native operating system's locking operations on | 40 // Attempts to perform the native operating system's locking operations on |
| 41 // the internal File handle | 41 // the internal File handle |
| 42 base::File::Error RawLockFile(); | 42 base::File::Error RawLockFile(); |
| 43 base::File::Error RawUnlockFile(); | 43 base::File::Error RawUnlockFile(); |
| 44 | 44 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 67 const DupCallback& callback) override; | 67 const DupCallback& callback) override; |
| 68 void Flush(const FlushCallback& callback) override; | 68 void Flush(const FlushCallback& callback) override; |
| 69 void Lock(const LockCallback& callback) override; | 69 void Lock(const LockCallback& callback) override; |
| 70 void Unlock(const UnlockCallback& callback) override; | 70 void Unlock(const UnlockCallback& callback) override; |
| 71 void AsHandle(const AsHandleCallback& callback) override; | 71 void AsHandle(const AsHandleCallback& callback) override; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 mojo::StrongBinding<File> binding_; | 74 mojo::StrongBinding<File> binding_; |
| 75 base::File file_; | 75 base::File file_; |
| 76 base::FilePath path_; | 76 base::FilePath path_; |
| 77 LockTable* lock_table_; | 77 scoped_refptr<LockTable> lock_table_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(FileImpl); | 79 DISALLOW_COPY_AND_ASSIGN(FileImpl); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace filesystem | 82 } // namespace filesystem |
| 83 | 83 |
| 84 #endif // COMPONENTS_FILESYSTEM_FILE_IMPL_H_ | 84 #endif // COMPONENTS_FILESYSTEM_FILE_IMPL_H_ |
| OLD | NEW |