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

Unified Diff: webkit/fileapi/file_system_operation.cc

Issue 6604020: Introduce FileSystemFileUtil and -Proxy to decorate base::file_util in webkit/fileapi. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Made file_system_operation_context_ a simple variable (replaced from not scoped_ptr.) Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/file_system_operation.h ('k') | webkit/fileapi/file_system_operation_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_operation.cc
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc
index b01f4d5cac3446cff4d09a4ec141c44b7a307733..dcec28a492f87badb6e93a4973a41dbb10238b32 100644
--- a/webkit/fileapi/file_system_operation.cc
+++ b/webkit/fileapi/file_system_operation.cc
@@ -8,6 +8,8 @@
#include "net/url_request/url_request_context.h"
#include "webkit/fileapi/file_system_callback_dispatcher.h"
#include "webkit/fileapi/file_system_context.h"
+#include "webkit/fileapi/file_system_file_util_proxy.h"
+#include "webkit/fileapi/file_system_operation_context.h"
#include "webkit/fileapi/file_system_path_manager.h"
#include "webkit/fileapi/file_system_quota_manager.h"
#include "webkit/fileapi/file_writer_delegate.h"
@@ -21,6 +23,7 @@ FileSystemOperation::FileSystemOperation(
: proxy_(proxy),
dispatcher_(dispatcher),
file_system_context_(file_system_context),
+ file_system_operation_context_(FileSystemFileUtil::GetInstance()),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
DCHECK(dispatcher);
#ifndef NDEBUG
@@ -30,7 +33,9 @@ FileSystemOperation::FileSystemOperation(
FileSystemOperation::~FileSystemOperation() {
if (file_writer_delegate_.get())
- base::FileUtilProxy::Close(proxy_, file_writer_delegate_->file(), NULL);
+ FileSystemFileUtilProxy::Close(
+ file_system_operation_context_,
+ proxy_, file_writer_delegate_->file(), NULL);
}
void FileSystemOperation::OpenFileSystem(
@@ -58,26 +63,29 @@ void FileSystemOperation::CreateFile(const FilePath& path,
delete this;
return;
}
- base::FileUtilProxy::EnsureFileExists(
- proxy_, path, callback_factory_.NewCallback(
- exclusive ? &FileSystemOperation::DidEnsureFileExistsExclusive
- : &FileSystemOperation::DidEnsureFileExistsNonExclusive));
+ FileSystemFileUtilProxy::EnsureFileExists(
+ file_system_operation_context_,
+ proxy_, path, callback_factory_.NewCallback(
+ exclusive ? &FileSystemOperation::DidEnsureFileExistsExclusive
+ : &FileSystemOperation::DidEnsureFileExistsNonExclusive));
}
void FileSystemOperation::CreateDirectory(const FilePath& path,
bool exclusive,
- bool recursive) {
+ bool unused) {
#ifndef NDEBUG
DCHECK(kOperationNone == pending_operation_);
pending_operation_ = kOperationCreateDirectory;
#endif
+ DCHECK(!unused);
if (!VerifyFileSystemPathForWrite(path, true /* create */, 0)) {
delete this;
return;
}
- base::FileUtilProxy::CreateDirectory(
- proxy_, path, exclusive, recursive, callback_factory_.NewCallback(
+ FileSystemFileUtilProxy::CreateDirectory(
+ file_system_operation_context_,
+ proxy_, path, exclusive, callback_factory_.NewCallback(
&FileSystemOperation::DidFinishFileOperation));
}
@@ -94,8 +102,9 @@ void FileSystemOperation::Copy(const FilePath& src_path,
delete this;
return;
}
- base::FileUtilProxy::Copy(proxy_, src_path, dest_path,
- callback_factory_.NewCallback(
+ FileSystemFileUtilProxy::Copy(
+ file_system_operation_context_,
+ proxy_, src_path, dest_path, callback_factory_.NewCallback(
&FileSystemOperation::DidFinishFileOperation));
}
@@ -112,8 +121,9 @@ void FileSystemOperation::Move(const FilePath& src_path,
delete this;
return;
}
- base::FileUtilProxy::Move(proxy_, src_path, dest_path,
- callback_factory_.NewCallback(
+ FileSystemFileUtilProxy::Move(
+ file_system_operation_context_,
+ proxy_, src_path, dest_path, callback_factory_.NewCallback(
&FileSystemOperation::DidFinishFileOperation));
}
@@ -127,8 +137,10 @@ void FileSystemOperation::DirectoryExists(const FilePath& path) {
delete this;
return;
}
- base::FileUtilProxy::GetFileInfo(proxy_, path, callback_factory_.NewCallback(
- &FileSystemOperation::DidDirectoryExists));
+ FileSystemFileUtilProxy::GetFileInfo(
+ file_system_operation_context_,
+ proxy_, path, callback_factory_.NewCallback(
+ &FileSystemOperation::DidDirectoryExists));
}
void FileSystemOperation::FileExists(const FilePath& path) {
@@ -141,8 +153,10 @@ void FileSystemOperation::FileExists(const FilePath& path) {
delete this;
return;
}
- base::FileUtilProxy::GetFileInfo(proxy_, path, callback_factory_.NewCallback(
- &FileSystemOperation::DidFileExists));
+ FileSystemFileUtilProxy::GetFileInfo(
+ file_system_operation_context_,
+ proxy_, path, callback_factory_.NewCallback(
+ &FileSystemOperation::DidFileExists));
}
void FileSystemOperation::GetMetadata(const FilePath& path) {
@@ -155,8 +169,10 @@ void FileSystemOperation::GetMetadata(const FilePath& path) {
delete this;
return;
}
- base::FileUtilProxy::GetFileInfo(proxy_, path, callback_factory_.NewCallback(
- &FileSystemOperation::DidGetMetadata));
+ FileSystemFileUtilProxy::GetFileInfo(
+ file_system_operation_context_,
+ proxy_, path, callback_factory_.NewCallback(
+ &FileSystemOperation::DidGetMetadata));
}
void FileSystemOperation::ReadDirectory(const FilePath& path) {
@@ -169,8 +185,9 @@ void FileSystemOperation::ReadDirectory(const FilePath& path) {
delete this;
return;
}
- base::FileUtilProxy::ReadDirectory(proxy_, path,
- callback_factory_.NewCallback(
+ FileSystemFileUtilProxy::ReadDirectory(
+ file_system_operation_context_,
+ proxy_, path, callback_factory_.NewCallback(
&FileSystemOperation::DidReadDirectory));
}
@@ -184,8 +201,9 @@ void FileSystemOperation::Remove(const FilePath& path, bool recursive) {
delete this;
return;
}
- base::FileUtilProxy::Delete(proxy_, path, recursive,
- callback_factory_.NewCallback(
+ FileSystemFileUtilProxy::Delete(
+ file_system_operation_context_,
+ proxy_, path, recursive, callback_factory_.NewCallback(
&FileSystemOperation::DidFinishFileOperation));
}
@@ -208,7 +226,8 @@ void FileSystemOperation::Write(
blob_request_.reset(
new net::URLRequest(blob_url, file_writer_delegate_.get()));
blob_request_->set_context(url_request_context);
- base::FileUtilProxy::CreateOrOpen(
+ FileSystemFileUtilProxy::CreateOrOpen(
+ file_system_operation_context_,
proxy_,
path,
base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE |
@@ -226,8 +245,9 @@ void FileSystemOperation::Truncate(const FilePath& path, int64 length) {
delete this;
return;
}
- base::FileUtilProxy::Truncate(proxy_, path, length,
- callback_factory_.NewCallback(
+ FileSystemFileUtilProxy::Truncate(
+ file_system_operation_context_,
+ proxy_, path, length, callback_factory_.NewCallback(
&FileSystemOperation::DidFinishFileOperation));
}
@@ -243,7 +263,8 @@ void FileSystemOperation::TouchFile(const FilePath& path,
delete this;
return;
}
- base::FileUtilProxy::Touch(
+ FileSystemFileUtilProxy::Touch(
+ file_system_operation_context_,
proxy_, path, last_access_time, last_modified_time,
callback_factory_.NewCallback(&FileSystemOperation::DidTouchFile));
}
« no previous file with comments | « webkit/fileapi/file_system_operation.h ('k') | webkit/fileapi/file_system_operation_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698