OLD | NEW |
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 WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 friend class SandboxMountPointProvider; | 123 friend class SandboxMountPointProvider; |
124 friend class TestMountPointProvider; | 124 friend class TestMountPointProvider; |
125 friend class chromeos::CrosMountPointProvider; | 125 friend class chromeos::CrosMountPointProvider; |
126 | 126 |
127 friend class FileSystemOperationTest; | 127 friend class FileSystemOperationTest; |
128 friend class FileSystemOperationWriteTest; | 128 friend class FileSystemOperationWriteTest; |
129 friend class FileWriterDelegateTest; | 129 friend class FileWriterDelegateTest; |
130 friend class FileSystemQuotaTest; | 130 friend class FileSystemQuotaTest; |
131 friend class LocalFileSystemTestOriginHelper; | 131 friend class LocalFileSystemTestOriginHelper; |
132 | 132 |
133 explicit LocalFileSystemOperation(FileSystemContext* file_system_context); | 133 LocalFileSystemOperation( |
| 134 FileSystemContext* file_system_context, |
| 135 scoped_ptr<FileSystemOperationContext> operation_context); |
134 | 136 |
135 FileSystemContext* file_system_context() const { | 137 FileSystemContext* file_system_context() const { |
136 return operation_context_.file_system_context(); | 138 return operation_context_->file_system_context(); |
137 } | |
138 | |
139 FileSystemOperationContext* file_system_operation_context() { | |
140 return &operation_context_; | |
141 } | 139 } |
142 | 140 |
143 // The unit tests that need to specify and control the lifetime of the | 141 // The unit tests that need to specify and control the lifetime of the |
144 // file_util on their own should call this before performing the actual | 142 // file_util on their own should call this before performing the actual |
145 // operation. If it is given it will not be overwritten by the class. | 143 // operation. If it is given it will not be overwritten by the class. |
146 void set_override_file_util(FileSystemFileUtil* file_util) { | 144 void set_override_file_util(FileSystemFileUtil* file_util) { |
147 src_util_ = file_util; | 145 src_util_ = file_util; |
148 dest_util_ = file_util; | 146 dest_util_ = file_util; |
149 } | 147 } |
150 | 148 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // Checks the validity of a given |url| and populates |file_util| for |mode|. | 231 // Checks the validity of a given |url| and populates |file_util| for |mode|. |
234 base::PlatformFileError SetUp( | 232 base::PlatformFileError SetUp( |
235 const FileSystemURL& url, | 233 const FileSystemURL& url, |
236 FileSystemFileUtil** file_util, | 234 FileSystemFileUtil** file_util, |
237 SetUpMode mode); | 235 SetUpMode mode); |
238 | 236 |
239 // Used only for internal assertions. | 237 // Used only for internal assertions. |
240 // Returns false if there's another inflight pending operation. | 238 // Returns false if there's another inflight pending operation. |
241 bool SetPendingOperationType(OperationType type); | 239 bool SetPendingOperationType(OperationType type); |
242 | 240 |
243 FileSystemOperationContext operation_context_; | 241 scoped_ptr<FileSystemOperationContext> operation_context_; |
244 FileSystemFileUtil* src_util_; // Not owned. | 242 FileSystemFileUtil* src_util_; // Not owned. |
245 FileSystemFileUtil* dest_util_; // Not owned. | 243 FileSystemFileUtil* dest_util_; // Not owned. |
246 | 244 |
247 // This is set before any write operations. The destructor of | 245 // This is set before any write operations. The destructor of |
248 // ScopedQuotaNotifier sends notification to the QuotaManager | 246 // ScopedQuotaNotifier sends notification to the QuotaManager |
249 // to tell the update is done; so that we can make sure notify | 247 // to tell the update is done; so that we can make sure notify |
250 // the manager after any write operations are done. | 248 // the manager after any write operations are done. |
251 scoped_ptr<ScopedQuotaNotifier> scoped_quota_notifier_; | 249 scoped_ptr<ScopedQuotaNotifier> scoped_quota_notifier_; |
252 | 250 |
253 // These are all used only by Write(). | 251 // These are all used only by Write(). |
(...skipping 20 matching lines...) Expand all Loading... |
274 // LocalFileSystemOperation instance is usually deleted upon completion but | 272 // LocalFileSystemOperation instance is usually deleted upon completion but |
275 // could be deleted while it has inflight callbacks when Cancel is called. | 273 // could be deleted while it has inflight callbacks when Cancel is called. |
276 base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_; | 274 base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_; |
277 | 275 |
278 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation); | 276 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation); |
279 }; | 277 }; |
280 | 278 |
281 } // namespace fileapi | 279 } // namespace fileapi |
282 | 280 |
283 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ | 281 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_OPERATION_H_ |
OLD | NEW |