Index: webkit/fileapi/file_system_operation.cc |
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc |
index 4ab97ef8a8d6520f5ac06e042eaa78d62b81478d..2d35868e4b4b1d5df77466fa787bab6d63baeb92 100644 |
--- a/webkit/fileapi/file_system_operation.cc |
+++ b/webkit/fileapi/file_system_operation.cc |
@@ -26,20 +26,6 @@ |
namespace fileapi { |
-namespace { |
- |
-void GetMetadataForSnapshot( |
- const FileSystemOperationInterface::SnapshotFileCallback& callback, |
- base::PlatformFileError result, |
- const base::PlatformFileInfo& file_info, |
- const FilePath& platform_path) { |
- // We don't want the third party to delete our local file, so just returning |
- // NULL as |file_reference|. |
- callback.Run(result, file_info, platform_path, NULL); |
-} |
- |
-} // anonymous namespace |
- |
class FileSystemOperation::ScopedQuotaNotifier { |
public: |
ScopedQuotaNotifier(FileSystemContext* context, |
@@ -444,7 +430,19 @@ void FileSystemOperation::SyncGetPlatformPath(const FileSystemURL& url, |
void FileSystemOperation::CreateSnapshotFile( |
const FileSystemURL& url, |
const SnapshotFileCallback& callback) { |
- GetMetadata(url, base::Bind(&GetMetadataForSnapshot, callback)); |
+ DCHECK(SetPendingOperationType(kOperationCreateSnapshotFile)); |
+ |
+ base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_READ); |
+ if (result != base::PLATFORM_FILE_OK) { |
+ callback.Run(result, base::PlatformFileInfo(), FilePath(), NULL); |
+ delete this; |
+ return; |
+ } |
+ |
+ FileSystemFileUtilProxy::CreateSnapshotFile( |
+ &operation_context_, src_util_, url, |
+ base::Bind(&FileSystemOperation::DidCreateSnapshotFile, |
+ base::Owned(this), callback)); |
} |
FileSystemOperation::FileSystemOperation( |
@@ -663,6 +661,15 @@ void FileSystemOperation::DidOpenFile( |
callback.Run(rv, file.ReleaseValue(), peer_handle_); |
} |
+void FileSystemOperation::DidCreateSnapshotFile( |
+ const SnapshotFileCallback& callback, |
+ base::PlatformFileError result, |
+ const base::PlatformFileInfo& file_info, |
+ const FilePath& platform_path, |
+ const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
+ callback.Run(result, file_info, platform_path, file_ref); |
+} |
+ |
base::PlatformFileError FileSystemOperation::SetUp( |
const FileSystemURL& url, |
FileSystemFileUtil** file_util, |