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

Unified Diff: webkit/fileapi/file_system_file_util_proxy.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_file_util_proxy.h ('k') | webkit/fileapi/file_system_operation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_file_util_proxy.cc
diff --git a/webkit/fileapi/file_system_file_util_proxy.cc b/webkit/fileapi/file_system_file_util_proxy.cc
index 7ecb0aef38a23808864650336797d4a1bce7d895..a566fc70d51fcafd7e80e9897ae4cbf4f6f906de 100644
--- a/webkit/fileapi/file_system_file_util_proxy.cc
+++ b/webkit/fileapi/file_system_file_util_proxy.cc
@@ -49,22 +49,34 @@ class GetFileInfoHelper {
public:
GetFileInfoHelper() : error_(base::PLATFORM_FILE_OK) {}
- void RunWork(FileSystemFileUtil* file_util,
- FileSystemOperationContext* context,
- const FileSystemURL& url) {
- error_ = file_util->GetFileInfo(
- context, url, &file_info_, &platform_path_);
+ void GetFileInfo(FileSystemFileUtil* file_util,
+ FileSystemOperationContext* context,
+ const FileSystemURL& url) {
+ error_ = file_util->GetFileInfo(context, url, &file_info_, &platform_path_);
+ }
+
+ void CreateSnapshotFile(FileSystemFileUtil* file_util,
+ FileSystemOperationContext* context,
+ const FileSystemURL& url) {
+ file_ref_ = file_util->CreateSnapshotFile(
+ context, url, &error_, &file_info_, &platform_path_);
}
- void Reply(const Proxy::GetFileInfoCallback& callback) {
+ void ReplyFileInfo(const Proxy::GetFileInfoCallback& callback) {
if (!callback.is_null())
callback.Run(error_, file_info_, platform_path_);
}
+ void ReplySnapshotFile(const Proxy::SnapshotFileCallback& callback) {
+ if (!callback.is_null())
+ callback.Run(error_, file_info_, platform_path_, file_ref_);
+ }
+
private:
base::PlatformFileError error_;
base::PlatformFileInfo file_info_;
FilePath platform_path_;
+ scoped_refptr<webkit_blob::ShareableFileReference> file_ref_;
DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper);
};
@@ -188,9 +200,23 @@ bool FileSystemFileUtilProxy::GetFileInfo(
GetFileInfoHelper* helper = new GetFileInfoHelper;
return context->file_task_runner()->PostTaskAndReply(
FROM_HERE,
- Bind(&GetFileInfoHelper::RunWork, Unretained(helper),
+ Bind(&GetFileInfoHelper::GetFileInfo, Unretained(helper),
+ file_util, context, url),
+ Bind(&GetFileInfoHelper::ReplyFileInfo, Owned(helper), callback));
+}
+
+// static
+bool FileSystemFileUtilProxy::CreateSnapshotFile(
+ FileSystemOperationContext* context,
+ FileSystemFileUtil* file_util,
+ const FileSystemURL& url,
+ const SnapshotFileCallback& callback) {
+ GetFileInfoHelper* helper = new GetFileInfoHelper;
+ return context->file_task_runner()->PostTaskAndReply(
+ FROM_HERE,
+ Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper),
file_util, context, url),
- Bind(&GetFileInfoHelper::Reply, Owned(helper), callback));
+ Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback));
}
// static
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.h ('k') | webkit/fileapi/file_system_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698