Chromium Code Reviews| Index: webkit/browser/fileapi/async_file_util_adapter.cc |
| diff --git a/webkit/browser/fileapi/async_file_util_adapter.cc b/webkit/browser/fileapi/async_file_util_adapter.cc |
| index b66cf02ae13bd91c8c254de402b3be48fae49288..57371f3b0202ca8c70319cc6e1e4853b3142d898 100644 |
| --- a/webkit/browser/fileapi/async_file_util_adapter.cc |
| +++ b/webkit/browser/fileapi/async_file_util_adapter.cc |
| @@ -133,11 +133,22 @@ void ReadDirectoryHelper(FileSystemFileUtil* file_util, |
| } |
| void RunCreateOrOpenCallback( |
| + FileSystemOperationContext* context, |
| const AsyncFileUtil::CreateOrOpenCallback& callback, |
| - base::File::Error result, |
| - base::PassPlatformFile file, |
| - bool created) { |
| - callback.Run(result, file, base::Closure()); |
| + base::File file) { |
| + // TODO(rvargas): Remove PlatformFile from AsyncFileUtil. |
| + base::File::Error error; |
| + base::PlatformFile platform_file; |
| + if (file.IsValid()) { |
| + error = base::File::FILE_OK; |
| + platform_file = file.TakePlatformFile(); |
| + } else { |
| + error = file.error_details(); |
| + platform_file = base::kInvalidPlatformFileValue; |
| + } |
| + |
| + callback.Run(error, base::PassPlatformFile(&platform_file), base::Closure()); |
| + base::File deleter(platform_file); |
|
kinuko
2014/05/12 05:39:57
nit: deleter -> closer might be better
rvargas (doing something else)
2014/05/12 23:39:59
Done.
|
| } |
| } // namespace |
| @@ -157,14 +168,12 @@ void AsyncFileUtilAdapter::CreateOrOpen( |
| int file_flags, |
| const CreateOrOpenCallback& callback) { |
| FileSystemOperationContext* context_ptr = context.release(); |
| - const bool success = base::FileUtilProxy::RelayCreateOrOpen( |
|
kinuko
2014/05/12 05:39:57
I think this is the last callsite of RelayCreateOr
rvargas (doing something else)
2014/05/12 23:39:59
Yes, I'm doing the cleanup after landing https://c
|
| + base::PostTaskAndReplyWithResult( |
| context_ptr->task_runner(), |
| + FROM_HERE, |
| Bind(&FileSystemFileUtil::CreateOrOpen, Unretained(sync_file_util_.get()), |
| context_ptr, url, file_flags), |
| - Bind(&FileSystemFileUtil::Close, Unretained(sync_file_util_.get()), |
| - base::Owned(context_ptr)), |
| - Bind(&RunCreateOrOpenCallback, callback)); |
| - DCHECK(success); |
| + Bind(&RunCreateOrOpenCallback, base::Owned(context_ptr), callback)); |
| } |
| void AsyncFileUtilAdapter::EnsureFileExists( |