diff options
author | hidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-10 07:55:18 +0000 |
---|---|---|
committer | hidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-10 07:55:18 +0000 |
commit | 969cbbe78bec88bad3a639bc4a76c256f997535b (patch) | |
tree | d8a7aad8c9626865c4838b321af1cc6f5b285b64 /webkit/browser | |
parent | a2bbb3a5060d98d7ce09fea74be26006aafbee35 (diff) | |
download | chromium_src-969cbbe78bec88bad3a639bc4a76c256f997535b.zip chromium_src-969cbbe78bec88bad3a639bc4a76c256f997535b.tar.gz chromium_src-969cbbe78bec88bad3a639bc4a76c256f997535b.tar.bz2 |
Add on_close_callback to AsyncFileUtil::CreateOrOpenCallback.
This is preparation of the migration between LocalFileSystemOperation and
RemoteFileSytemOperation. Especially, on ChromeOS Drive File System, it is
necessary to call CloseFile on file closing, but currently we have no way
to do it with AsyncFileUtil.
This CL adds a callback for the behavior. The Drive File System side
implementation will be done in another CL.
BUG=258303
TEST=Ran unit_tests and broser_tests --gtest_filter="*FileSystemExtensionApiTest*:*FileManagerBrowserTest*"
Review URL: https://chromiumcodereview.appspot.com/18856009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser')
4 files changed, 11 insertions, 11 deletions
diff --git a/webkit/browser/fileapi/async_file_util.h b/webkit/browser/fileapi/async_file_util.h index e714c99..def2d2d 100644 --- a/webkit/browser/fileapi/async_file_util.h +++ b/webkit/browser/fileapi/async_file_util.h @@ -47,9 +47,13 @@ class WEBKIT_STORAGE_BROWSER_EXPORT AsyncFileUtil { typedef base::Callback< void(base::PlatformFileError result)> StatusCallback; + // |on_close_callback| will be called after the |file| is closed in the + // child process. |on_close_callback|.is_null() can be true, if no operation + // is needed on closing the file. typedef base::Callback< void(base::PlatformFileError result, - base::PassPlatformFile file)> CreateOrOpenCallback; + base::PassPlatformFile file, + const base::Closure& on_close_callback)> CreateOrOpenCallback; typedef base::Callback< void(base::PlatformFileError result, diff --git a/webkit/browser/fileapi/async_file_util_adapter.cc b/webkit/browser/fileapi/async_file_util_adapter.cc index ca12953..807c2e2 100644 --- a/webkit/browser/fileapi/async_file_util_adapter.cc +++ b/webkit/browser/fileapi/async_file_util_adapter.cc @@ -131,7 +131,7 @@ void RunCreateOrOpenCallback( base::PlatformFileError result, base::PassPlatformFile file, bool created) { - callback.Run(result, file); + callback.Run(result, file, base::Closure()); } } // namespace diff --git a/webkit/browser/fileapi/local_file_system_operation.cc b/webkit/browser/fileapi/local_file_system_operation.cc index 688ada6..1309caf 100644 --- a/webkit/browser/fileapi/local_file_system_operation.cc +++ b/webkit/browser/fileapi/local_file_system_operation.cc @@ -32,10 +32,6 @@ using webkit_blob::ScopedFile; namespace fileapi { -namespace { -void NopCloseFileCallback() {} -} - LocalFileSystemOperation::LocalFileSystemOperation( const FileSystemURL& url, FileSystemContext* file_system_context, @@ -528,12 +524,11 @@ void LocalFileSystemOperation::DidWrite( void LocalFileSystemOperation::DidOpenFile( const OpenFileCallback& callback, base::PlatformFileError rv, - base::PassPlatformFile file) { + base::PassPlatformFile file, + const base::Closure& on_close_callback) { if (rv == base::PLATFORM_FILE_OK) CHECK_NE(base::kNullProcessHandle, peer_handle_); - callback.Run(rv, file.ReleaseValue(), - base::Bind(&NopCloseFileCallback), - peer_handle_); + callback.Run(rv, file.ReleaseValue(), on_close_callback, peer_handle_); } bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { diff --git a/webkit/browser/fileapi/local_file_system_operation.h b/webkit/browser/fileapi/local_file_system_operation.h index 0ccf33c..1ccaf40 100644 --- a/webkit/browser/fileapi/local_file_system_operation.h +++ b/webkit/browser/fileapi/local_file_system_operation.h @@ -231,7 +231,8 @@ class WEBKIT_STORAGE_BROWSER_EXPORT LocalFileSystemOperation FileWriterDelegate::WriteProgressStatus write_status); void DidOpenFile(const OpenFileCallback& callback, base::PlatformFileError rv, - base::PassPlatformFile file); + base::PassPlatformFile file, + const base::Closure& on_close_callback); // Used only for internal assertions. // Returns false if there's another inflight pending operation. |