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

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: Renamed ScopedOriginUpdateHelper. 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 {
kinuko 2011/08/25 09:12:00 I think we can just declare 'class ScopedQuotaUtil
Dai Mikurube (NOT FULLTIME) 2011/08/25 09:19:46 We have to pass this quota_util_helper from a func
kinuko 2011/08/29 05:22:51 If keeping it as a member var is the only concern
Dai Mikurube (NOT FULLTIME) 2011/08/30 08:03:01 Thanks for the information! Done it.
97 public:
98 explicit ScopedQuotaUtilHelper(FileSystemContext* context,
99 const GURL& origin_url,
100 FileSystemType type);
101 ~ScopedQuotaUtilHelper();
102
103 private:
104 FileSystemQuotaUtil* quota_util_;
105 const GURL& origin_url_;
106 FileSystemType type_;
107 DISALLOW_COPY_AND_ASSIGN(ScopedQuotaUtilHelper);
108 };
109
95 FileSystemContext* file_system_context() const { 110 FileSystemContext* file_system_context() const {
96 return file_system_operation_context_.file_system_context(); 111 return file_system_operation_context_.file_system_context();
97 } 112 }
98 113
99 FileSystemOperationContext* file_system_operation_context() { 114 FileSystemOperationContext* file_system_operation_context() {
100 return &file_system_operation_context_; 115 return &file_system_operation_context_;
101 } 116 }
102 117
103 friend class FileSystemOperationTest; 118 friend class FileSystemOperationTest;
104 friend class FileSystemOperationWriteTest; 119 friend class FileSystemOperationWriteTest;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 247
233 // Proxy for calling file_util_proxy methods. 248 // Proxy for calling file_util_proxy methods.
234 scoped_refptr<base::MessageLoopProxy> proxy_; 249 scoped_refptr<base::MessageLoopProxy> proxy_;
235 250
236 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_; 251 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_;
237 252
238 FileSystemOperationContext file_system_operation_context_; 253 FileSystemOperationContext file_system_operation_context_;
239 254
240 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_; 255 base::ScopedCallbackFactory<FileSystemOperation> callback_factory_;
241 256
257 scoped_ptr<ScopedQuotaUtilHelper> quota_util_helper_;
258
242 // These are all used only by Write(). 259 // These are all used only by Write().
243 friend class FileWriterDelegate; 260 friend class FileWriterDelegate;
244 scoped_ptr<FileWriterDelegate> file_writer_delegate_; 261 scoped_ptr<FileWriterDelegate> file_writer_delegate_;
245 scoped_ptr<net::URLRequest> blob_request_; 262 scoped_ptr<net::URLRequest> blob_request_;
246 scoped_ptr<FileSystemOperation> cancel_operation_; 263 scoped_ptr<FileSystemOperation> cancel_operation_;
247 264
248 // Used only by OpenFile, in order to clone the file handle back to the 265 // Used only by OpenFile, in order to clone the file handle back to the
249 // requesting process. 266 // requesting process.
250 base::ProcessHandle peer_handle_; 267 base::ProcessHandle peer_handle_;
251 268
(...skipping 12 matching lines...) Expand all
264 281
265 // Length to be truncated. 282 // Length to be truncated.
266 int64 length_; 283 int64 length_;
267 284
268 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); 285 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation);
269 }; 286 };
270 287
271 } // namespace fileapi 288 } // namespace fileapi
272 289
273 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ 290 #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/quota_file_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698