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

Unified Diff: webkit/fileapi/file_system_operation.cc

Issue 10815003: Adding FileUtil::CreateSnapshotFile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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_util_helper.cc » ('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 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,
« no previous file with comments | « webkit/fileapi/file_system_operation.h ('k') | webkit/fileapi/file_util_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698