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

Unified Diff: content/child/fileapi/webfilesystem_impl.cc

Issue 18427005: Implement async version of WebFileSystem::createFileWriter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « content/child/fileapi/webfilesystem_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/fileapi/webfilesystem_impl.cc
diff --git a/content/child/fileapi/webfilesystem_impl.cc b/content/child/fileapi/webfilesystem_impl.cc
index e05ded3733d9d8f42be30235e8a2f349f5cc4495..d4affe6515839a724d0e4b51f12bdd1c63418d73 100644
--- a/content/child/fileapi/webfilesystem_impl.cc
+++ b/content/child/fileapi/webfilesystem_impl.cc
@@ -24,6 +24,23 @@ using WebKit::WebVector;
namespace content {
+namespace {
+
+void DidReadMetadataForCreateFileWriter(
+ const GURL& path,
+ WebKit::WebFileWriterClient* client,
+ WebKit::WebFileSystemCallbacks* callbacks,
+ const base::PlatformFileInfo& file_info) {
+ if (file_info.is_directory || file_info.size < 0) {
+ callbacks->didFail(WebKit::WebFileErrorInvalidState);
+ return;
+ }
+ callbacks->didCreateFileWriter(new WebFileWriterImpl(path, client),
+ file_info.size);
+}
+
+} // namespace
+
WebFileSystemImpl::WebFileSystemImpl() {
}
@@ -130,6 +147,19 @@ WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter(
return new WebFileWriterImpl(GURL(path), client);
}
+void WebFileSystemImpl::createFileWriter(
+ const WebURL& path,
+ WebKit::WebFileWriterClient* client,
+ WebKit::WebFileSystemCallbacks* callbacks) {
+ FileSystemDispatcher* dispatcher =
+ ChildThread::current()->file_system_dispatcher();
+ dispatcher->ReadMetadata(
+ GURL(path),
+ base::Bind(&DidReadMetadataForCreateFileWriter,
+ GURL(path), client, callbacks),
+ base::Bind(&FileStatusCallbackAdapter, callbacks));
+}
+
void WebFileSystemImpl::createSnapshotFileAndReadMetadata(
const WebKit::WebURL& path,
WebKit::WebFileSystemCallbacks* callbacks) {
« no previous file with comments | « content/child/fileapi/webfilesystem_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698