diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-26 07:13:20 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-26 07:13:20 +0000 |
commit | 7ab45cfa8a5c642583ad25cf6a876292048fc6a1 (patch) | |
tree | 9f80f24b6b0e139bd57a76f592cb033c950d6c41 | |
parent | 024371da68824e676962119e1e44e6fc07607f40 (diff) | |
download | chromium_src-7ab45cfa8a5c642583ad25cf6a876292048fc6a1.zip chromium_src-7ab45cfa8a5c642583ad25cf6a876292048fc6a1.tar.gz chromium_src-7ab45cfa8a5c642583ad25cf6a876292048fc6a1.tar.bz2 |
Change some snapshot- or temporary-file related changes to use ScopedFile
- Remove FileSnapshotPolicy, and change
FileSystemFileUtil::CreateSnapshotFile() to return webkit_blob::ScopedFile
(if implementors want the backend to control the snapshot file's lifetime).
This allows implementors to set arbitrary callbacks and
also reduces the possibility of snapshot file leakage.
- Change DriveFileSyncService's temporary file handling to use
webkit_blob::ScopedFile to simplify the codebase & reduce the
possibility of temporary file leakage.
BUG=162598
TEST=existing tests
Review URL: https://codereview.chromium.org/14075016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196640 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc | 18 | ||||
-rw-r--r-- | chrome/browser/media_galleries/fileapi/device_media_async_file_util.h | 2 | ||||
-rw-r--r-- | chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc | 1 | ||||
-rw-r--r-- | chrome/browser/sync_file_system/drive_file_sync_service.cc | 44 | ||||
-rw-r--r-- | webkit/fileapi/async_file_util.h | 22 | ||||
-rw-r--r-- | webkit/fileapi/async_file_util_adapter.cc | 19 | ||||
-rw-r--r-- | webkit/fileapi/file_snapshot_policy.h | 26 | ||||
-rw-r--r-- | webkit/fileapi/file_system_file_util.h | 8 | ||||
-rw-r--r-- | webkit/fileapi/local_file_system_operation.cc | 10 | ||||
-rw-r--r-- | webkit/fileapi/local_file_system_operation.h | 6 | ||||
-rw-r--r-- | webkit/fileapi/local_file_util.cc | 17 | ||||
-rw-r--r-- | webkit/fileapi/local_file_util.h | 6 | ||||
-rw-r--r-- | webkit/fileapi/obfuscated_file_util.cc | 17 | ||||
-rw-r--r-- | webkit/fileapi/obfuscated_file_util.h | 6 |
14 files changed, 89 insertions, 113 deletions
diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc index 1c7046c..45345e7 100644 --- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc @@ -12,6 +12,7 @@ #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" +#include "webkit/blob/shareable_file_reference.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_operation_context.h" #include "webkit/fileapi/file_system_task_runners.h" @@ -20,6 +21,7 @@ using fileapi::FileSystemOperationContext; using fileapi::FileSystemURL; +using webkit_blob::ShareableFileReference; namespace chrome { @@ -309,11 +311,16 @@ void DeviceMediaAsyncFileUtil::OnReadDirectoryError( void DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile( const AsyncFileUtil::CreateSnapshotFileCallback& callback, + base::SequencedTaskRunner* media_task_runner, const base::PlatformFileInfo& file_info, const base::FilePath& platform_path) { - if (!callback.is_null()) - callback.Run(base::PLATFORM_FILE_OK, file_info, platform_path, - fileapi::kSnapshotFileTemporary); + if (callback.is_null()) + return; + callback.Run(base::PLATFORM_FILE_OK, file_info, platform_path, + ShareableFileReference::GetOrCreate( + platform_path, + ShareableFileReference::DELETE_ON_FINAL_RELEASE, + media_task_runner)); } void DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError( @@ -321,7 +328,7 @@ void DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError( base::PlatformFileError error) { if (!callback.is_null()) callback.Run(error, base::PlatformFileInfo(), base::FilePath(), - fileapi::kSnapshotFileTemporary); + scoped_refptr<ShareableFileReference>()); } void DeviceMediaAsyncFileUtil::OnSnapshotFileCreatedRunTask( @@ -344,7 +351,8 @@ void DeviceMediaAsyncFileUtil::OnSnapshotFileCreatedRunTask( *snapshot_file_path, base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile, weak_ptr_factory_.GetWeakPtr(), - callback), + callback, + make_scoped_refptr(context->task_runner())), base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError, weak_ptr_factory_.GetWeakPtr(), callback)); diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h index dde43a8..3a32f67 100644 --- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h +++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h @@ -11,6 +11,7 @@ #include "webkit/fileapi/async_file_util.h" namespace base { +class SequencedTaskRunner; class Time; } @@ -142,6 +143,7 @@ class DeviceMediaAsyncFileUtil : public fileapi::AsyncFileUtil { // the CreateSnapshotFile request. void OnDidCreateSnapshotFile( const AsyncFileUtil::CreateSnapshotFileCallback& callback, + base::SequencedTaskRunner* media_task_runner, const base::PlatformFileInfo& file_info, const base::FilePath& platform_path); diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc index 6a85713..b40ac06 100644 --- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc +++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc @@ -29,7 +29,6 @@ #include "chrome/browser/media_galleries/win/snapshot_file_details.h" #include "chrome/browser/storage_monitor/storage_monitor.h" #include "content/public/browser/browser_thread.h" -#include "webkit/fileapi/file_snapshot_policy.h" #include "webkit/fileapi/file_system_task_runners.h" #include "webkit/fileapi/file_system_util.h" diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc index b81cc8330..750ad5b 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc @@ -31,6 +31,7 @@ #include "chrome/common/extensions/extension.h" #include "content/public/browser/browser_thread.h" #include "extensions/common/constants.h" +#include "webkit/blob/scoped_file.h" #include "webkit/fileapi/file_system_url.h" #include "webkit/fileapi/syncable/sync_file_metadata.h" #include "webkit/fileapi/syncable/sync_file_type.h" @@ -47,22 +48,17 @@ const base::FilePath::CharType kSyncFileSystemDir[] = FILE_PATH_LITERAL("Sync FileSystem"); bool CreateTemporaryFile(const base::FilePath& dir_path, - base::FilePath* temp_file) { - return file_util::CreateDirectory(dir_path) && - file_util::CreateTemporaryFileInDir(dir_path, temp_file); -} - -void DeleteTemporaryFile(const base::FilePath& file_path) { - if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)) { - content::BrowserThread::PostTask( - content::BrowserThread::FILE, FROM_HERE, - base::Bind(&DeleteTemporaryFile, file_path)); - return; - } - - if (!file_util::Delete(file_path, true)) - LOG(ERROR) << "Leaked temporary file for Sync FileSystem: " - << file_path.value(); + webkit_blob::ScopedFile* temp_file) { + base::FilePath temp_file_path; + const bool success = file_util::CreateDirectory(dir_path) && + file_util::CreateTemporaryFileInDir(dir_path, &temp_file_path); + if (!success) + return success; + *temp_file = webkit_blob::ScopedFile( + temp_file_path, + webkit_blob::ScopedFile::DELETE_ON_SCOPE_OUT, + base::MessageLoopProxy::current()); + return success; } void EmptyStatusCallback(SyncStatusCode status) {} @@ -151,7 +147,7 @@ struct DriveFileSyncService::ProcessRemoteChangeParam { DriveMetadata drive_metadata; SyncFileMetadata local_metadata; bool metadata_updated; - base::FilePath temporary_file_path; + webkit_blob::ScopedFile temporary_file; std::string md5_checksum; SyncAction sync_action; bool clear_local_changes; @@ -1568,13 +1564,10 @@ void DriveFileSyncService::DidResolveConflictToLocalChange( void DriveFileSyncService::DownloadForRemoteSync( scoped_ptr<ProcessRemoteChangeParam> param) { - // TODO(tzik): Use ShareableFileReference here after we get thread-safe - // version of it. crbug.com/162598 - base::FilePath* temporary_file_path = ¶m->temporary_file_path; + webkit_blob::ScopedFile* temporary_file = ¶m->temporary_file; content::BrowserThread::PostTaskAndReplyWithResult( content::BrowserThread::FILE, FROM_HERE, - base::Bind(&CreateTemporaryFile, - temporary_file_dir_, temporary_file_path), + base::Bind(&CreateTemporaryFile, temporary_file_dir_, temporary_file), base::Bind(&DriveFileSyncService::DidGetTemporaryFileForDownload, AsWeakPtr(), base::Passed(¶m))); } @@ -1587,8 +1580,9 @@ void DriveFileSyncService::DidGetTemporaryFileForDownload( return; } - const base::FilePath& temporary_file_path = param->temporary_file_path; + const base::FilePath& temporary_file_path = param->temporary_file.path(); std::string resource_id = param->remote_change.resource_id; + DCHECK(!temporary_file_path.empty()); // We should not use the md5 in metadata for FETCH type to avoid the download // finishes due to NOT_MODIFIED. @@ -1623,7 +1617,7 @@ void DriveFileSyncService::DidDownloadFileForRemoteSync( param->drive_metadata.set_md5_checksum(md5_checksum); const FileChange& change = param->remote_change.change; - const base::FilePath& temporary_file_path = param->temporary_file_path; + const base::FilePath& temporary_file_path = param->temporary_file.path(); const FileSystemURL& url = param->remote_change.url; remote_change_processor_->ApplyRemoteChange( change, temporary_file_path, url, @@ -1724,8 +1718,6 @@ void DriveFileSyncService::FinalizeRemoteSync( return; } - if (!param->temporary_file_path.empty()) - DeleteTemporaryFile(param->temporary_file_path); NotifyTaskDone(status, param->token.Pass()); if (status == SYNC_STATUS_OK && param->sync_action != SYNC_ACTION_NONE) { NotifyObserversFileStatusChanged(param->remote_change.url, diff --git a/webkit/fileapi/async_file_util.h b/webkit/fileapi/async_file_util.h index 10b76af8..298a7a1 100644 --- a/webkit/fileapi/async_file_util.h +++ b/webkit/fileapi/async_file_util.h @@ -9,13 +9,16 @@ #include "base/callback_forward.h" #include "base/files/file_util_proxy.h" #include "base/platform_file.h" -#include "webkit/fileapi/file_snapshot_policy.h" #include "webkit/storage/webkit_storage_export.h" namespace base { class Time; } +namespace webkit_blob { +class ShareableFileReference; +} + namespace fileapi { class FileSystemOperationContext; @@ -55,7 +58,8 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil { void(base::PlatformFileError result, const base::PlatformFileInfo& file_info, const base::FilePath& platform_path, - SnapshotFilePolicy policy)> CreateSnapshotFileCallback; + const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref + )> CreateSnapshotFileCallback; AsyncFileUtil() {} virtual ~AsyncFileUtil() {} @@ -297,9 +301,17 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil { // // In the callback, it returns: // |file_info| is the metadata of the snapshot file created. - // |platform_path| is the path to the snapshot file created. - // |policy| should indicate the policy how the fileapi backend - // should handle the returned file. + // |platform_path| is the full absolute platform path to the snapshot + // file created. If a file is not backed by a real local file in + // the implementor's FileSystem, the implementor must create a + // local snapshot file and return the path of the created file. + // + // If implementors creates a temporary file for snapshotting and wants + // FileAPI backend to take care of the lifetime of the file (so that + // it won't get deleted while JS layer has any references to the created + // File/Blob object), it should return non-empty |file_ref|. + // Via the |file_ref| implementors can schedule a file deletion + // or arbitrary callbacks when the last reference of File/Blob is dropped. // // LocalFileSystemOperation::CreateSnapshotFile calls this. // diff --git a/webkit/fileapi/async_file_util_adapter.cc b/webkit/fileapi/async_file_util_adapter.cc index eb30f3f..62fb835 100644 --- a/webkit/fileapi/async_file_util_adapter.cc +++ b/webkit/fileapi/async_file_util_adapter.cc @@ -7,19 +7,21 @@ #include "base/bind.h" #include "base/sequenced_task_runner.h" #include "base/task_runner_util.h" +#include "webkit/blob/shareable_file_reference.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_operation_context.h" #include "webkit/fileapi/file_system_url.h" #include "webkit/fileapi/file_system_util.h" -namespace fileapi { - using base::Bind; using base::Callback; using base::Owned; using base::PlatformFileError; using base::Unretained; +using webkit_blob::ShareableFileReference; + +namespace fileapi { namespace { @@ -47,8 +49,7 @@ class EnsureFileExistsHelper { class GetFileInfoHelper { public: GetFileInfoHelper() - : error_(base::PLATFORM_FILE_OK), - snapshot_policy_(kSnapshotFileUnknown) {} + : error_(base::PLATFORM_FILE_OK) {} void GetFileInfo(FileSystemFileUtil* file_util, FileSystemOperationContext* context, @@ -59,8 +60,8 @@ class GetFileInfoHelper { void CreateSnapshotFile(FileSystemFileUtil* file_util, FileSystemOperationContext* context, const FileSystemURL& url) { - error_ = file_util->CreateSnapshotFile( - context, url, &file_info_, &platform_path_, &snapshot_policy_); + scoped_file_ = file_util->CreateSnapshotFile( + context, url, &error_, &file_info_, &platform_path_); } void ReplyFileInfo(const AsyncFileUtil::GetFileInfoCallback& callback) { @@ -70,16 +71,16 @@ class GetFileInfoHelper { void ReplySnapshotFile( const AsyncFileUtil::CreateSnapshotFileCallback& callback) { - DCHECK(snapshot_policy_ != kSnapshotFileUnknown); if (!callback.is_null()) - callback.Run(error_, file_info_, platform_path_, snapshot_policy_); + callback.Run(error_, file_info_, platform_path_, + ShareableFileReference::GetOrCreate(scoped_file_.Pass())); } private: base::PlatformFileError error_; base::PlatformFileInfo file_info_; base::FilePath platform_path_; - SnapshotFilePolicy snapshot_policy_; + webkit_blob::ScopedFile scoped_file_; DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); }; diff --git a/webkit/fileapi/file_snapshot_policy.h b/webkit/fileapi/file_snapshot_policy.h deleted file mode 100644 index 7386684..0000000 --- a/webkit/fileapi/file_snapshot_policy.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_FILEAPI_FILE_SNAPSHOT_POLICY_H_ -#define WEBKIT_FILEAPI_FILE_SNAPSHOT_POLICY_H_ - -namespace fileapi { - -// A policy flag for CreateSnapshotFile. -enum SnapshotFilePolicy { - kSnapshotFileUnknown, - - // The implementation just uses the local file as the snapshot file. - // The FileAPI backend does nothing on the returned file. - kSnapshotFileLocal, - - // The implementation returns a temporary file as the snapshot file. - // The FileAPI backend takes care of the lifetime of the returned file - // and will delete when the last reference of the file is dropped. - kSnapshotFileTemporary, -}; - -} // namespace fileapi - -#endif // WEBKIT_FILEAPI_FILE_SNAPSHOT_POLICY_H_ diff --git a/webkit/fileapi/file_system_file_util.h b/webkit/fileapi/file_system_file_util.h index 66b539b..5a094f1 100644 --- a/webkit/fileapi/file_system_file_util.h +++ b/webkit/fileapi/file_system_file_util.h @@ -8,7 +8,7 @@ #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/platform_file.h" -#include "webkit/fileapi/file_snapshot_policy.h" +#include "webkit/blob/scoped_file.h" #include "webkit/storage/webkit_storage_export.h" namespace base { @@ -170,12 +170,12 @@ class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { // // See header comments for AsyncFileUtil::CreateSnapshotFile() for // more details. - virtual base::PlatformFileError CreateSnapshotFile( + virtual webkit_blob::ScopedFile CreateSnapshotFile( FileSystemOperationContext* context, const FileSystemURL& url, + base::PlatformFileError* error, base::PlatformFileInfo* file_info, - base::FilePath* platform_path, - SnapshotFilePolicy* policy) = 0; + base::FilePath* platform_path) = 0; protected: FileSystemFileUtil() {} diff --git a/webkit/fileapi/local_file_system_operation.cc b/webkit/fileapi/local_file_system_operation.cc index 1bd0e52..ce1378e 100644 --- a/webkit/fileapi/local_file_system_operation.cc +++ b/webkit/fileapi/local_file_system_operation.cc @@ -28,6 +28,7 @@ #include "webkit/quota/quota_manager.h" #include "webkit/quota/quota_types.h" +using webkit_blob::ScopedFile; using webkit_blob::ShareableFileReference; namespace fileapi { @@ -827,14 +828,7 @@ void LocalFileSystemOperation::DidCreateSnapshotFile( base::PlatformFileError result, const base::PlatformFileInfo& file_info, const base::FilePath& platform_path, - SnapshotFilePolicy snapshot_policy) { - scoped_refptr<ShareableFileReference> file_ref; - if (result == base::PLATFORM_FILE_OK && - snapshot_policy == kSnapshotFileTemporary) { - file_ref = ShareableFileReference::GetOrCreate( - platform_path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, - file_system_context()->task_runners()->file_task_runner()); - } + const scoped_refptr<ShareableFileReference>& file_ref) { callback.Run(result, file_info, platform_path, file_ref); } diff --git a/webkit/fileapi/local_file_system_operation.h b/webkit/fileapi/local_file_system_operation.h index f3f7083..08365c9 100644 --- a/webkit/fileapi/local_file_system_operation.h +++ b/webkit/fileapi/local_file_system_operation.h @@ -9,7 +9,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "webkit/fileapi/file_snapshot_policy.h" +#include "webkit/blob/scoped_file.h" #include "webkit/fileapi/file_system_operation.h" #include "webkit/fileapi/file_system_url.h" #include "webkit/fileapi/file_writer_delegate.h" @@ -281,10 +281,10 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation bool created); void DidCreateSnapshotFile( const SnapshotFileCallback& callback, - base::PlatformFileError rv, + base::PlatformFileError result, const base::PlatformFileInfo& file_info, const base::FilePath& platform_path, - SnapshotFilePolicy snapshot_policy); + const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); // Checks the validity of a given |url| and populates |file_util| for |mode|. base::PlatformFileError SetUp( diff --git a/webkit/fileapi/local_file_util.cc b/webkit/fileapi/local_file_util.cc index 6e65518..4760423 100644 --- a/webkit/fileapi/local_file_util.cc +++ b/webkit/fileapi/local_file_util.cc @@ -246,21 +246,18 @@ PlatformFileError LocalFileUtil::DeleteDirectory( return NativeFileUtil::DeleteDirectory(file_path); } -base::PlatformFileError LocalFileUtil::CreateSnapshotFile( +webkit_blob::ScopedFile LocalFileUtil::CreateSnapshotFile( FileSystemOperationContext* context, const FileSystemURL& url, + base::PlatformFileError* error, base::PlatformFileInfo* file_info, - base::FilePath* platform_path, - SnapshotFilePolicy* policy) { - DCHECK(policy); + base::FilePath* platform_path) { DCHECK(file_info); // We're just returning the local file information. - *policy = kSnapshotFileLocal; - base::PlatformFileError error = - GetFileInfo(context, url, file_info, platform_path); - if (error == base::PLATFORM_FILE_OK && file_info->is_directory) - return base::PLATFORM_FILE_ERROR_NOT_A_FILE; - return error; + *error = GetFileInfo(context, url, file_info, platform_path); + if (*error == base::PLATFORM_FILE_OK && file_info->is_directory) + *error = base::PLATFORM_FILE_ERROR_NOT_A_FILE; + return webkit_blob::ScopedFile(); } } // namespace fileapi diff --git a/webkit/fileapi/local_file_util.h b/webkit/fileapi/local_file_util.h index f7bc9f9..0321f2c6 100644 --- a/webkit/fileapi/local_file_util.h +++ b/webkit/fileapi/local_file_util.h @@ -82,12 +82,12 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileUtil : public FileSystemFileUtil { virtual base::PlatformFileError DeleteDirectory( FileSystemOperationContext* context, const FileSystemURL& url) OVERRIDE; - virtual base::PlatformFileError CreateSnapshotFile( + virtual webkit_blob::ScopedFile CreateSnapshotFile( FileSystemOperationContext* context, const FileSystemURL& url, + base::PlatformFileError* error, base::PlatformFileInfo* file_info, - base::FilePath* platform_path, - SnapshotFilePolicy* snapshot_policy) OVERRIDE; + base::FilePath* platform_path) OVERRIDE; private: // Given the filesystem url, produces a real, full local path for the diff --git a/webkit/fileapi/obfuscated_file_util.cc b/webkit/fileapi/obfuscated_file_util.cc index 84dd1f6..8103e62 100644 --- a/webkit/fileapi/obfuscated_file_util.cc +++ b/webkit/fileapi/obfuscated_file_util.cc @@ -857,22 +857,19 @@ PlatformFileError ObfuscatedFileUtil::DeleteDirectory( return base::PLATFORM_FILE_OK; } -base::PlatformFileError ObfuscatedFileUtil::CreateSnapshotFile( +webkit_blob::ScopedFile ObfuscatedFileUtil::CreateSnapshotFile( FileSystemOperationContext* context, const FileSystemURL& url, + base::PlatformFileError* error, base::PlatformFileInfo* file_info, - base::FilePath* platform_path, - SnapshotFilePolicy* policy) { - DCHECK(policy); + base::FilePath* platform_path) { // We're just returning the local file information. - *policy = kSnapshotFileLocal; - base::PlatformFileError error = GetFileInfo( - context, url, file_info, platform_path); - if (error == base::PLATFORM_FILE_OK && file_info->is_directory) { + *error = GetFileInfo(context, url, file_info, platform_path); + if (*error == base::PLATFORM_FILE_OK && file_info->is_directory) { *file_info = base::PlatformFileInfo(); - return base::PLATFORM_FILE_ERROR_NOT_A_FILE; + *error = base::PLATFORM_FILE_ERROR_NOT_A_FILE; } - return error; + return webkit_blob::ScopedFile(); } scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> diff --git a/webkit/fileapi/obfuscated_file_util.h b/webkit/fileapi/obfuscated_file_util.h index 74c5f04..7f13995 100644 --- a/webkit/fileapi/obfuscated_file_util.h +++ b/webkit/fileapi/obfuscated_file_util.h @@ -112,12 +112,12 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil virtual base::PlatformFileError DeleteDirectory( FileSystemOperationContext* context, const FileSystemURL& url) OVERRIDE; - virtual base::PlatformFileError CreateSnapshotFile( + virtual webkit_blob::ScopedFile CreateSnapshotFile( FileSystemOperationContext* context, const FileSystemURL& url, + base::PlatformFileError* error, base::PlatformFileInfo* file_info, - base::FilePath* platform_path, - SnapshotFilePolicy* policy) OVERRIDE; + base::FilePath* platform_path) OVERRIDE; // Same as the other CreateFileEnumerator, but with recursive support. scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( |