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

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

Issue 8508001: Retry: Bind: Merge FileUtilProxy and FileSystemFileUtilProxy: Delete/Touch/Truncate/Copy/Move (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.cc ('k') | webkit/fileapi/file_system_operation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/weak_ptr.h"
17 #include "base/message_loop_proxy.h" 16 #include "base/message_loop_proxy.h"
18 #include "base/platform_file.h" 17 #include "base/platform_file.h"
19 #include "base/process.h" 18 #include "base/process.h"
20 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
21 #include "webkit/fileapi/file_system_operation_context.h" 20 #include "webkit/fileapi/file_system_operation_context.h"
22 #include "webkit/fileapi/file_system_types.h" 21 #include "webkit/fileapi/file_system_types.h"
23 #include "webkit/quota/quota_manager.h" 22 #include "webkit/quota/quota_manager.h"
24 23
25 namespace base { 24 namespace base {
26 class Time; 25 class Time;
(...skipping 11 matching lines...) Expand all
38 class FileSystemCallbackDispatcher; 37 class FileSystemCallbackDispatcher;
39 class FileSystemContext; 38 class FileSystemContext;
40 class FileWriterDelegate; 39 class FileWriterDelegate;
41 class FileSystemOperationTest; 40 class FileSystemOperationTest;
42 class FileSystemQuotaUtil; 41 class FileSystemQuotaUtil;
43 42
44 // 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.
45 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists, 44 // Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists,
46 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of 45 // GetMetadata, ReadDirectory and Remove) may be called during the lifetime of
47 // this object and it should be called no more than once. 46 // this object and it should be called no more than once.
48 // This class is self-destructed and an instance automatically gets deleted 47 // This class is self-destructed, or get deleted via base::Owned() fater the
49 // when its operation is finished. 48 // operation finishes and completion callback is called.
50 class FileSystemOperation { 49 class FileSystemOperation {
51 public: 50 public:
52 // |dispatcher| will be owned by this class. 51 // |dispatcher| will be owned by this class.
53 FileSystemOperation(FileSystemCallbackDispatcher* dispatcher, 52 FileSystemOperation(FileSystemCallbackDispatcher* dispatcher,
54 scoped_refptr<base::MessageLoopProxy> proxy, 53 scoped_refptr<base::MessageLoopProxy> proxy,
55 FileSystemContext* file_system_context); 54 FileSystemContext* file_system_context);
56 virtual ~FileSystemOperation(); 55 virtual ~FileSystemOperation();
57 56
58 void OpenFileSystem(const GURL& origin_url, 57 void OpenFileSystem(const GURL& origin_url,
59 fileapi::FileSystemType type, 58 fileapi::FileSystemType type,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // operation. If it is given it will not be overwritten by the class. 112 // operation. If it is given it will not be overwritten by the class.
114 void set_override_file_util(FileSystemFileUtil* file_util) { 113 void set_override_file_util(FileSystemFileUtil* file_util) {
115 operation_context_.set_src_file_util(file_util); 114 operation_context_.set_src_file_util(file_util);
116 operation_context_.set_dest_file_util(file_util); 115 operation_context_.set_dest_file_util(file_util);
117 } 116 }
118 117
119 void GetUsageAndQuotaThenCallback( 118 void GetUsageAndQuotaThenCallback(
120 const GURL& origin_url, 119 const GURL& origin_url,
121 const quota::QuotaManager::GetUsageAndQuotaCallback& callback); 120 const quota::QuotaManager::GetUsageAndQuotaCallback& callback);
122 121
123 void DelayedCreateFileForQuota(quota::QuotaStatusCode status, 122 void DelayedCreateFileForQuota(bool exclusive,
123 quota::QuotaStatusCode status,
124 int64 usage, int64 quota); 124 int64 usage, int64 quota);
125 void DelayedCreateDirectoryForQuota(quota::QuotaStatusCode status, 125 void DelayedCreateDirectoryForQuota(bool exclusive, bool recursive,
126 quota::QuotaStatusCode status,
126 int64 usage, int64 quota); 127 int64 usage, int64 quota);
127 void DelayedCopyForQuota(quota::QuotaStatusCode status, 128 void DelayedCopyForQuota(quota::QuotaStatusCode status,
128 int64 usage, int64 quota); 129 int64 usage, int64 quota);
129 void DelayedMoveForQuota(quota::QuotaStatusCode status, 130 void DelayedMoveForQuota(quota::QuotaStatusCode status,
130 int64 usage, int64 quota); 131 int64 usage, int64 quota);
131 void DelayedWriteForQuota(quota::QuotaStatusCode status, 132 void DelayedWriteForQuota(quota::QuotaStatusCode status,
132 int64 usage, int64 quota); 133 int64 usage, int64 quota);
133 void DelayedTruncateForQuota(quota::QuotaStatusCode status, 134 void DelayedTruncateForQuota(int64 length,
135 quota::QuotaStatusCode status,
134 int64 usage, int64 quota); 136 int64 usage, int64 quota);
135 void DelayedOpenFileForQuota(quota::QuotaStatusCode status, 137 void DelayedOpenFileForQuota(int file_flags,
138 quota::QuotaStatusCode status,
136 int64 usage, int64 quota); 139 int64 usage, int64 quota);
137 140
138 // A callback used for OpenFileSystem. 141 // A callback used for OpenFileSystem.
139 void DidGetRootPath(bool success, 142 void DidGetRootPath(bool success,
140 const FilePath& path, 143 const FilePath& path,
141 const std::string& name); 144 const std::string& name);
142 145
143 // Callback for CreateFile for |exclusive|=true cases. 146 // Callback for CreateFile for |exclusive|=true cases.
144 void DidEnsureFileExistsExclusive(base::PlatformFileError rv, 147 void DidEnsureFileExistsExclusive(base::PlatformFileError rv,
145 bool created); 148 bool created);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 #endif 252 #endif
250 253
251 // Proxy for calling file_util_proxy methods. 254 // Proxy for calling file_util_proxy methods.
252 scoped_refptr<base::MessageLoopProxy> proxy_; 255 scoped_refptr<base::MessageLoopProxy> proxy_;
253 256
254 // This can be NULL if the operation is cancelled on the way. 257 // This can be NULL if the operation is cancelled on the way.
255 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_; 258 scoped_ptr<FileSystemCallbackDispatcher> dispatcher_;
256 259
257 FileSystemOperationContext operation_context_; 260 FileSystemOperationContext operation_context_;
258 261
259 base::WeakPtrFactory<FileSystemOperation> weak_factory_;
260
261 scoped_ptr<ScopedQuotaUtilHelper> quota_util_helper_; 262 scoped_ptr<ScopedQuotaUtilHelper> quota_util_helper_;
262 263
263 // These are all used only by Write(). 264 // These are all used only by Write().
264 friend class FileWriterDelegate; 265 friend class FileWriterDelegate;
265 scoped_ptr<FileWriterDelegate> file_writer_delegate_; 266 scoped_ptr<FileWriterDelegate> file_writer_delegate_;
266 scoped_ptr<net::URLRequest> blob_request_; 267 scoped_ptr<net::URLRequest> blob_request_;
267 scoped_ptr<FileSystemOperation> cancel_operation_; 268 scoped_ptr<FileSystemOperation> cancel_operation_;
268 269
269 // Used only by OpenFile, in order to clone the file handle back to the 270 // Used only by OpenFile, in order to clone the file handle back to the
270 // requesting process. 271 // requesting process.
271 base::ProcessHandle peer_handle_; 272 base::ProcessHandle peer_handle_;
272 273
273 // Used to keep a virtual path around while we check for quota. 274 // Used to keep a virtual path around while we check for quota.
274 // If an operation needs only one path, use src_virtual_path_, even if it's a 275 // If an operation needs only one path, use src_virtual_path_, even if it's a
275 // write. 276 // write.
276 FilePath src_virtual_path_; 277 FilePath src_virtual_path_;
277 FilePath dest_virtual_path_; 278 FilePath dest_virtual_path_;
278 279
279 // Options for CreateFile and CreateDirectory.
280 bool exclusive_;
281 bool recursive_;
282
283 // Options for OpenFile.
284 int file_flags_;
285
286 // Length to be truncated.
287 int64 length_;
288
289 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); 280 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation);
290 }; 281 };
291 282
292 } // namespace fileapi 283 } // namespace fileapi
293 284
294 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ 285 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.cc ('k') | webkit/fileapi/file_system_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698