Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 class AsyncFileUtil; | 28 class AsyncFileUtil; |
| 29 class CopyOrMoveFileValidatorFactory; | 29 class CopyOrMoveFileValidatorFactory; |
| 30 class FileSystemURL; | 30 class FileSystemURL; |
| 31 class FileStreamWriter; | 31 class FileStreamWriter; |
| 32 class FileSystemContext; | 32 class FileSystemContext; |
| 33 class FileSystemFileUtil; | 33 class FileSystemFileUtil; |
| 34 class FileSystemOperation; | 34 class FileSystemOperation; |
| 35 class FileSystemQuotaUtil; | 35 class FileSystemQuotaUtil; |
| 36 class WatcherManager; | 36 class WatcherManager; |
| 37 | 37 |
| 38 // Maximum value of length arguments used for | |
| 39 // FileSystemBackend::CreateFileStreamReader(). | |
| 40 const int64 kMaximumLength = std::numeric_limits<int64>::max(); | |
|
hashimoto
2014/09/04 11:21:25
Why is this constant needed?
mtomasz
2014/09/05 01:04:40
Having a call:
new FileStreamReader(0, kMaximumLe
| |
| 41 | |
| 38 // An interface for defining a file system backend. | 42 // An interface for defining a file system backend. |
| 39 // | 43 // |
| 40 // NOTE: when you implement a new FileSystemBackend for your own | 44 // NOTE: when you implement a new FileSystemBackend for your own |
| 41 // FileSystem module, please contact to kinuko@chromium.org. | 45 // FileSystem module, please contact to kinuko@chromium.org. |
| 42 // | 46 // |
| 43 class STORAGE_EXPORT FileSystemBackend { | 47 class STORAGE_EXPORT FileSystemBackend { |
| 44 public: | 48 public: |
| 45 // Callback for InitializeFileSystem. | 49 // Callback for InitializeFileSystem. |
| 46 typedef base::Callback<void(const GURL& root_url, | 50 typedef base::Callback<void(const GURL& root_url, |
| 47 const std::string& name, | 51 const std::string& name, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 // read/write implementation. | 105 // read/write implementation. |
| 102 virtual bool HasInplaceCopyImplementation(FileSystemType type) const = 0; | 106 virtual bool HasInplaceCopyImplementation(FileSystemType type) const = 0; |
| 103 | 107 |
| 104 // Creates a new file stream reader for a given filesystem URL |url| with an | 108 // Creates a new file stream reader for a given filesystem URL |url| with an |
| 105 // offset |offset|. |expected_modification_time| specifies the expected last | 109 // offset |offset|. |expected_modification_time| specifies the expected last |
| 106 // modification if the value is non-null, the reader will check the underlying | 110 // modification if the value is non-null, the reader will check the underlying |
| 107 // file's actual modification time to see if the file has been modified, and | 111 // file's actual modification time to see if the file has been modified, and |
| 108 // if it does any succeeding read operations should fail with | 112 // if it does any succeeding read operations should fail with |
| 109 // ERR_UPLOAD_FILE_CHANGED error. | 113 // ERR_UPLOAD_FILE_CHANGED error. |
| 110 // This method itself does *not* check if the given path exists and is a | 114 // This method itself does *not* check if the given path exists and is a |
| 111 // regular file. | 115 // regular file. At most |limit| bytes can be fetched from the file stream |
| 112 // The |length| argument says how many bytes are going to be read using the | 116 // reader. |
| 113 // instance of the file stream reader. If unknown, then equal to -1. | |
| 114 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( | 117 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
| 115 const FileSystemURL& url, | 118 const FileSystemURL& url, |
| 116 int64 offset, | 119 int64 offset, |
| 120 int64 limit, | |
|
hashimoto
2014/09/04 11:21:25
It's not unclear from the word |limit| if this val
mtomasz
2014/09/05 01:04:40
This naming OFFSET and LIMIT is used widely in dat
| |
| 117 const base::Time& expected_modification_time, | 121 const base::Time& expected_modification_time, |
| 118 FileSystemContext* context) const = 0; | 122 FileSystemContext* context) const = 0; |
| 119 | 123 |
| 120 // Creates a new file stream writer for a given filesystem URL |url| with an | 124 // Creates a new file stream writer for a given filesystem URL |url| with an |
| 121 // offset |offset|. | 125 // offset |offset|. |
| 122 // This method itself does *not* check if the given path exists and is a | 126 // This method itself does *not* check if the given path exists and is a |
| 123 // regular file. | 127 // regular file. |
| 124 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 128 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( |
| 125 const FileSystemURL& url, | 129 const FileSystemURL& url, |
| 126 int64 offset, | 130 int64 offset, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 155 const std::string& extension_id) = 0; | 159 const std::string& extension_id) = 0; |
| 156 // Gets virtual path by known filesystem path. Returns false when filesystem | 160 // Gets virtual path by known filesystem path. Returns false when filesystem |
| 157 // path is not exposed by this provider. | 161 // path is not exposed by this provider. |
| 158 virtual bool GetVirtualPath(const base::FilePath& file_system_path, | 162 virtual bool GetVirtualPath(const base::FilePath& file_system_path, |
| 159 base::FilePath* virtual_path) = 0; | 163 base::FilePath* virtual_path) = 0; |
| 160 }; | 164 }; |
| 161 | 165 |
| 162 } // namespace storage | 166 } // namespace storage |
| 163 | 167 |
| 164 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 168 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
| OLD | NEW |