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

Side by Side Diff: webkit/fileapi/file_system_operation.h

Issue 7433006: Pepper quota support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_FILEAPI_FILE_SYSTEM_OPERATION_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists, 43 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists,
44 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of 44 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of
45 // this object and it should be called no more than once. 45 // this object and it should be called no more than once.
46 // This class is self-destructed and an instance automatically gets deleted 46 // This class is self-destructed and an instance automatically gets deleted
47 // when its operation is finished. 47 // when its operation is finished.
48 class FileSystemOperation { 48 class FileSystemOperation {
49 public: 49 public:
50 // |dispatcher| will be owned by this class. 50 // |dispatcher| will be owned by this class.
51 // |file_system_file_util| is optional; if supplied, it will not be deleted by 51 // |file_system_file_util| is optional; if supplied, it will not be deleted by
52 // the class. It's expecting a pointer to a singleton. 52 // the class. It's expecting a pointer to a singleton.
53 FileSystemOperation(FileSystemCallbackDispatcher* dispatcher, 53 FileSystemOperation(FileSystemCallbackDispatcher* dispatcher,
54 scoped_refptr<base::MessageLoopProxy> proxy, 54 scoped_refptr<base::MessageLoopProxy> proxy,
55 FileSystemContext* file_system_context, 55 FileSystemContext* file_system_context,
56 FileSystemFileUtil* file_system_file_util); 56 FileSystemFileUtil* file_system_file_util);
57 virtual ~FileSystemOperation(); 57 virtual ~FileSystemOperation();
58 58
59 void OpenFileSystem(const GURL& origin_url, 59 void OpenFileSystem(const GURL& origin_url,
60 fileapi::FileSystemType type, 60 fileapi::FileSystemType type,
61 bool create); 61 bool create);
62 void CreateFile(const GURL& path, 62 void CreateFile(const GURL& path,
63 bool exclusive); 63 bool exclusive);
64 void CreateDirectory(const GURL& path, 64 void CreateDirectory(const GURL& path,
65 bool exclusive, 65 bool exclusive,
66 bool recursive); 66 bool recursive);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 friend class FileSystemOperationTest; 103 friend class FileSystemOperationTest;
104 friend class FileSystemOperationWriteTest; 104 friend class FileSystemOperationWriteTest;
105 friend class FileWriterDelegateTest; 105 friend class FileWriterDelegateTest;
106 friend class FileSystemTestOriginHelper; 106 friend class FileSystemTestOriginHelper;
107 friend class FileSystemQuotaTest; 107 friend class FileSystemQuotaTest;
108 108
109 bool GetUsageAndQuotaThenCallback( 109 bool GetUsageAndQuotaThenCallback(
110 const GURL& origin_url, 110 const GURL& origin_url,
111 FileSystemType type,
111 quota::QuotaManager::GetUsageAndQuotaCallback* callback); 112 quota::QuotaManager::GetUsageAndQuotaCallback* callback);
112 113
113 void DelayedCopyForQuota(quota::QuotaStatusCode status, 114 void DelayedCopyForQuota(quota::QuotaStatusCode status,
114 int64 usage, int64 quota); 115 int64 usage, int64 quota);
115 void DelayedMoveForQuota(quota::QuotaStatusCode status, 116 void DelayedMoveForQuota(quota::QuotaStatusCode status,
116 int64 usage, int64 quota); 117 int64 usage, int64 quota);
117 void DelayedWriteForQuota(quota::QuotaStatusCode status, 118 void DelayedWriteForQuota(quota::QuotaStatusCode status,
118 int64 usage, int64 quota); 119 int64 usage, int64 quota);
119 void DelayedTruncateForQuota(quota::QuotaStatusCode status, 120 void DelayedTruncateForQuota(quota::QuotaStatusCode status,
120 int64 usage, int64 quota); 121 int64 usage, int64 quota);
(...skipping 27 matching lines...) Expand all
148 base::PlatformFileError rv, 149 base::PlatformFileError rv,
149 const std::vector<base::FileUtilProxy::Entry>& entries); 150 const std::vector<base::FileUtilProxy::Entry>& entries);
150 void DidWrite( 151 void DidWrite(
151 base::PlatformFileError rv, 152 base::PlatformFileError rv,
152 int64 bytes, 153 int64 bytes,
153 bool complete); 154 bool complete);
154 void DidTouchFile(base::PlatformFileError rv); 155 void DidTouchFile(base::PlatformFileError rv);
155 void DidOpenFile( 156 void DidOpenFile(
156 base::PlatformFileError rv, 157 base::PlatformFileError rv,
157 base::PassPlatformFile file, 158 base::PassPlatformFile file,
158 bool created); 159 bool created,
160 int64 file_size);
159 161
160 // Helper for Write(). 162 // Helper for Write().
161 void OnFileOpenedForWrite( 163 void OnFileOpenedForWrite(
162 base::PlatformFileError rv, 164 base::PlatformFileError rv,
163 base::PassPlatformFile file, 165 base::PassPlatformFile file,
164 bool created); 166 bool created,
167 int64 file_size);
165 168
166 // Checks the validity of a given |path| for reading, cracks the path into 169 // Checks the validity of a given |path| for reading, cracks the path into
167 // root URL and virtual path components, and returns the correct 170 // root URL and virtual path components, and returns the correct
168 // FileSystemFileUtil subclass for this type. 171 // FileSystemFileUtil subclass for this type.
169 // Returns true if the given |path| is a valid FileSystem path. 172 // Returns true if the given |path| is a valid FileSystem path.
170 // Otherwise it calls dispatcher's DidFail method with 173 // Otherwise it calls dispatcher's DidFail method with
171 // PLATFORM_FILE_ERROR_SECURITY and returns false. 174 // PLATFORM_FILE_ERROR_SECURITY and returns false.
172 // (Note: this doesn't delete this when it calls DidFail and returns false; 175 // (Note: this doesn't delete this when it calls DidFail and returns false;
173 // it's the caller's responsibility.) 176 // it's the caller's responsibility.)
174 bool VerifyFileSystemPathForRead(const GURL& path, 177 bool VerifyFileSystemPathForRead(const GURL& path,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 scoped_ptr<net::URLRequest> blob_request_; 242 scoped_ptr<net::URLRequest> blob_request_;
240 scoped_ptr<FileSystemOperation> cancel_operation_; 243 scoped_ptr<FileSystemOperation> cancel_operation_;
241 244
242 // Used only by OpenFile, in order to clone the file handle back to the 245 // Used only by OpenFile, in order to clone the file handle back to the
243 // requesting process. 246 // requesting process.
244 base::ProcessHandle peer_handle_; 247 base::ProcessHandle peer_handle_;
245 248
246 // Length to be truncated. 249 // Length to be truncated.
247 int64 length_; 250 int64 length_;
248 251
252 // Indicates whether this operation may modify the filesystem or not.
253 bool is_write_operation_;
254
249 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); 255 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation);
250 }; 256 };
251 257
252 } // namespace fileapi 258 } // namespace fileapi
253 259
254 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ 260 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698