Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: storage/browser/fileapi/file_system_backend.h

Issue 470323003: [fsp] Improve performance for reading small chunks of data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ 5 #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
6 #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ 6 #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
7 7
8 #include <limits>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
12 #include "base/files/file.h" 13 #include "base/files/file.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "storage/browser/fileapi/file_permission_policy.h" 16 #include "storage/browser/fileapi/file_permission_policy.h"
16 #include "storage/browser/fileapi/open_file_system_mode.h" 17 #include "storage/browser/fileapi/open_file_system_mode.h"
17 #include "storage/browser/storage_browser_export.h" 18 #include "storage/browser/storage_browser_export.h"
(...skipping 10 matching lines...) Expand all
28 class FileStreamWriter; 29 class FileStreamWriter;
29 class FileSystemContext; 30 class FileSystemContext;
30 class FileSystemFileUtil; 31 class FileSystemFileUtil;
31 class FileSystemOperation; 32 class FileSystemOperation;
32 class FileSystemQuotaUtil; 33 class FileSystemQuotaUtil;
33 class WatcherManager; 34 class WatcherManager;
34 35
35 // Callback to take GURL. 36 // Callback to take GURL.
36 typedef base::Callback<void(const GURL& url)> URLCallback; 37 typedef base::Callback<void(const GURL& url)> URLCallback;
37 38
39 // Maximum numer of bytes to be read by FileStreamReader classes. Used in
40 // FileSystemBackend::CreateFileStreamReader(), when it's not known how many
41 // bytes will be fetched in total.
42 const int64 kMaximumLength = std::numeric_limits<int64>::max();
43
38 // An interface for defining a file system backend. 44 // An interface for defining a file system backend.
39 // 45 //
40 // NOTE: when you implement a new FileSystemBackend for your own 46 // NOTE: when you implement a new FileSystemBackend for your own
41 // FileSystem module, please contact to kinuko@chromium.org. 47 // FileSystem module, please contact to kinuko@chromium.org.
42 // 48 //
43 class STORAGE_EXPORT FileSystemBackend { 49 class STORAGE_EXPORT FileSystemBackend {
44 public: 50 public:
45 // Callback for InitializeFileSystem. 51 // Callback for InitializeFileSystem.
46 typedef base::Callback<void(const GURL& root_url, 52 typedef base::Callback<void(const GURL& root_url,
47 const std::string& name, 53 const std::string& name,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // read/write implementation. 107 // read/write implementation.
102 virtual bool HasInplaceCopyImplementation(FileSystemType type) const = 0; 108 virtual bool HasInplaceCopyImplementation(FileSystemType type) const = 0;
103 109
104 // Creates a new file stream reader for a given filesystem URL |url| with an 110 // Creates a new file stream reader for a given filesystem URL |url| with an
105 // offset |offset|. |expected_modification_time| specifies the expected last 111 // offset |offset|. |expected_modification_time| specifies the expected last
106 // modification if the value is non-null, the reader will check the underlying 112 // 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 113 // 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 114 // if it does any succeeding read operations should fail with
109 // ERR_UPLOAD_FILE_CHANGED error. 115 // ERR_UPLOAD_FILE_CHANGED error.
110 // This method itself does *not* check if the given path exists and is a 116 // This method itself does *not* check if the given path exists and is a
111 // regular file. 117 // regular file. At most |max_bytes_to_read| can be fetched from the file
112 // The |length| argument says how many bytes are going to be read using the 118 // stream reader.
113 // instance of the file stream reader. If unknown, then equal to -1.
114 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( 119 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader(
115 const FileSystemURL& url, 120 const FileSystemURL& url,
116 int64 offset, 121 int64 offset,
122 int64 max_bytes_to_read,
117 const base::Time& expected_modification_time, 123 const base::Time& expected_modification_time,
118 FileSystemContext* context) const = 0; 124 FileSystemContext* context) const = 0;
119 125
120 // Creates a new file stream writer for a given filesystem URL |url| with an 126 // Creates a new file stream writer for a given filesystem URL |url| with an
121 // offset |offset|. 127 // offset |offset|.
122 // This method itself does *not* check if the given path exists and is a 128 // This method itself does *not* check if the given path exists and is a
123 // regular file. 129 // regular file.
124 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( 130 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter(
125 const FileSystemURL& url, 131 const FileSystemURL& url,
126 int64 offset, 132 int64 offset,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Gets a redirect URL for contents. e.g. Google Drive URL for hosted 166 // Gets a redirect URL for contents. e.g. Google Drive URL for hosted
161 // documents. Returns empty URL if the entry does not have the redirect URL. 167 // documents. Returns empty URL if the entry does not have the redirect URL.
162 virtual void GetRedirectURLForContents( 168 virtual void GetRedirectURLForContents(
163 const storage::FileSystemURL& url, 169 const storage::FileSystemURL& url,
164 const storage::URLCallback& callback) = 0; 170 const storage::URLCallback& callback) = 0;
165 }; 171 };
166 172
167 } // namespace storage 173 } // namespace storage
168 174
169 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ 175 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698