diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 08:04:24 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 08:04:24 +0000 |
commit | 9f4b25319081a76f4b31ba84661e76ebc48f8f53 (patch) | |
tree | 7ed097469a65979a14ac0c180f7d5d3c70f77cfe /content/child/fileapi | |
parent | 44ad4ec6d1a43ecc3429d82b01bd2414698af9dd (diff) | |
download | chromium_src-9f4b25319081a76f4b31ba84661e76ebc48f8f53.zip chromium_src-9f4b25319081a76f4b31ba84661e76ebc48f8f53.tar.gz chromium_src-9f4b25319081a76f4b31ba84661e76ebc48f8f53.tar.bz2 |
Implement async version of WebFileSystem::createFileWriter
To cleanup callback chain in Blink side.
The interface is introduced in r154035
Corresponding blink patch: https://codereview.chromium.org/18411005/
BUG=257349
TEST=no behavioral changes
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/18427005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/child/fileapi')
-rw-r--r-- | content/child/fileapi/webfilesystem_impl.cc | 30 | ||||
-rw-r--r-- | content/child/fileapi/webfilesystem_impl.h | 4 |
2 files changed, 34 insertions, 0 deletions
diff --git a/content/child/fileapi/webfilesystem_impl.cc b/content/child/fileapi/webfilesystem_impl.cc index 69057aa..9bb8664 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) { diff --git a/content/child/fileapi/webfilesystem_impl.h b/content/child/fileapi/webfilesystem_impl.h index 2bcf535..6ca0c5b 100644 --- a/content/child/fileapi/webfilesystem_impl.h +++ b/content/child/fileapi/webfilesystem_impl.h @@ -59,6 +59,10 @@ class WebFileSystemImpl : public WebKit::WebFileSystem { WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual WebKit::WebFileWriter* createFileWriter( const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE; + virtual void createFileWriter( + const WebKit::WebURL& path, + WebKit::WebFileWriterClient*, + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void createSnapshotFileAndReadMetadata( const WebKit::WebURL& path, WebKit::WebFileSystemCallbacks*); |