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

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

Issue 7671039: Count-up/down the dirty count in the usage cache at FileSystemOperation, not at QuotaFU. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reflected the comments. Created 9 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) 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"
11 #include "base/file_util_proxy.h" 11 #include "base/file_util_proxy.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_callback_factory.h" 14 #include "base/memory/scoped_callback_factory.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop_proxy.h" 16 #include "base/message_loop_proxy.h"
17 #include "base/platform_file.h" 17 #include "base/platform_file.h"
18 #include "base/process.h" 18 #include "base/process.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 #include "webkit/fileapi/file_system_operation_context.h"
20 #include "webkit/fileapi/file_system_types.h" 21 #include "webkit/fileapi/file_system_types.h"
21 #include "webkit/fileapi/file_system_operation_context.h"
22 #include "webkit/quota/quota_manager.h" 22 #include "webkit/quota/quota_manager.h"
23 23
24 namespace base { 24 namespace base {
25 class Time; 25 class Time;
26 } 26 }
27 27
28 namespace net { 28 namespace net {
29 class URLRequest; 29 class URLRequest;
30 class URLRequestContext; 30 class URLRequestContext;
31 } // namespace net 31 } // namespace net
32 32
33 class GURL; 33 class GURL;
34 34
35 namespace fileapi { 35 namespace fileapi {
36 36
37 class FileSystemCallbackDispatcher; 37 class FileSystemCallbackDispatcher;
38 class FileSystemContext; 38 class FileSystemContext;
39 class FileWriterDelegate; 39 class FileWriterDelegate;
40 class FileSystemOperationTest; 40 class FileSystemOperationTest;
41 class FileSystemQuotaUtil;
41 42
42 // This class is designed to serve one-time file system operation per instance. 43 // This class is designed to serve one-time file system operation per instance.
43 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists, 44 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists,
44 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of 45 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of
45 // this object and it should be called no more than once. 46 // this object and it should be called no more than once.
46 // This class is self-destructed and an instance automatically gets deleted 47 // This class is self-destructed and an instance automatically gets deleted
47 // when its operation is finished. 48 // when its operation is finished.
48 class FileSystemOperation { 49 class FileSystemOperation {
49 public: 50 public:
50 // |dispatcher| will be owned by this class. 51 // |dispatcher| will be owned by this class.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const GURL& path, 86 const GURL& path,
86 int file_flags, 87 int file_flags,
87 base::ProcessHandle peer_handle); 88 base::ProcessHandle peer_handle);
88 89
89 // Try to cancel the current operation [we support cancelling write or 90 // Try to cancel the current operation [we support cancelling write or
90 // truncate only]. Report failure for the current operation, then tell the 91 // truncate only]. Report failure for the current operation, then tell the
91 // passed-in operation to report success. 92 // passed-in operation to report success.
92 void Cancel(FileSystemOperation* cancel_operation); 93 void Cancel(FileSystemOperation* cancel_operation);
93 94
94 private: 95 private:
96 class ScopedQuotaUtilHelper;
97
95 FileSystemContext* file_system_context() const { 98 FileSystemContext* file_system_context() const {
96 return file_system_operation_context_.file_system_context(); 99 return file_system_operation_context_.file_system_context();
97 } 100 }
98 101
99 FileSystemOperationContext* file_system_operation_context() { 102 FileSystemOperationContext* file_system_operation_context() {
100 return &file_system_operation_context_; 103 return &file_system_operation_context_;
101 } 104 }
102 105
103 friend class FileSystemOperationTest; 106 friend class FileSystemOperationTest;
104 friend class FileSystemOperationWriteTest; 107 friend class FileSystemOperationWriteTest;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 235
233 // Proxy for calling file_util_proxy methods. 236 // Proxy for calling file_util_proxy methods.
234 scoped_refptr<base::MessageLoopProxy> proxy_; 237 scoped_refptr<base::MessageLoopProxy> proxy_;
235 238
236 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_; 239 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_;
237 240
238 FileSystemOperationContext file_system_operation_context_; 241 FileSystemOperationContext file_system_operation_context_;
239 242
240 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_; 243 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_;
241 244
245 scoped_ptr<ScopedQuotaUtilHelper> quota_util_helper_;
246
242 // These are all used only by Write(). 247 // These are all used only by Write().
243 friend class FileWriterDelegate; 248 friend class FileWriterDelegate;
244 scoped_ptr<FileWriterDelegate> file_writer_delegate_; 249 scoped_ptr<FileWriterDelegate> file_writer_delegate_;
245 scoped_ptr<net::URLRequest> blob_request_; 250 scoped_ptr<net::URLRequest> blob_request_;
246 scoped_ptr<FileSystemOperation> cancel_operation_; 251 scoped_ptr<FileSystemOperation> cancel_operation_;
247 252
248 // Used only by OpenFile, in order to clone the file handle back to the 253 // Used only by OpenFile, in order to clone the file handle back to the
249 // requesting process. 254 // requesting process.
250 base::ProcessHandle peer_handle_; 255 base::ProcessHandle peer_handle_;
251 256
(...skipping 12 matching lines...) Expand all
264 269
265 // Length to be truncated. 270 // Length to be truncated.
266 int64 length_; 271 int64 length_;
267 272
268 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); 273 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation);
269 }; 274 };
270 275
271 } // namespace fileapi 276 } // namespace fileapi
272 277
273 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ 278 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_system_operation.cc » ('j') | webkit/fileapi/file_system_operation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698