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

Unified Diff: Source/web/AsyncFileSystemChromium.cpp

Issue 18411005: Use the async version of WebFileSystem::createFileWriter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | « no previous file | Source/web/AsyncFileWriterChromium.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/AsyncFileSystemChromium.cpp
diff --git a/Source/web/AsyncFileSystemChromium.cpp b/Source/web/AsyncFileSystemChromium.cpp
index 91d0f50967ec36a673b2cde04c25fc5d48d932c4..32d2e4fa808dedacaa6d9715d291c2fdf2b0cc1e 100644
--- a/Source/web/AsyncFileSystemChromium.cpp
+++ b/Source/web/AsyncFileSystemChromium.cpp
@@ -109,72 +109,12 @@ void AsyncFileSystemChromium::readDirectory(const KURL& path, PassOwnPtr<AsyncFi
m_webFileSystem->readDirectory(path, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
-class FileWriterHelperCallbacks : public WebKit::WebFileSystemCallbacks {
-public:
- FileWriterHelperCallbacks(AsyncFileWriterClient* client, const KURL& path, WebKit::WebFileSystem* webFileSystem, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks)
- : m_client(client)
- , m_path(path)
- , m_webFileSystem(webFileSystem)
- , m_callbacks(callbacks)
- {
- }
-
- virtual void didSucceed()
- {
- ASSERT_NOT_REACHED();
- delete this;
- }
- virtual void didReadMetadata(const WebKit::WebFileInfo& info)
- {
- ASSERT(m_callbacks);
- if (info.type != WebKit::WebFileInfo::TypeFile || info.length < 0)
- m_callbacks->didFail(WebKit::WebFileErrorInvalidState);
- else {
- OwnPtr<AsyncFileWriterChromium> asyncFileWriterChromium = adoptPtr(new AsyncFileWriterChromium(m_client));
- OwnPtr<WebKit::WebFileWriter> webFileWriter = adoptPtr(m_webFileSystem->createFileWriter(m_path, asyncFileWriterChromium.get()));
- asyncFileWriterChromium->setWebFileWriter(webFileWriter.release());
- m_callbacks->didCreateFileWriter(asyncFileWriterChromium.release(), info.length);
- }
- delete this;
- }
- virtual void didCreateSnapshotFile(const WebKit::WebFileInfo& info)
- {
- ASSERT_NOT_REACHED();
- delete this;
- }
- virtual void didReadDirectory(const WebKit::WebVector<WebKit::WebFileSystemEntry>& entries, bool hasMore)
- {
- ASSERT_NOT_REACHED();
- delete this;
- }
- virtual void didOpenFileSystem(const WebKit::WebString& name, const WebKit::WebURL& rootURL)
- {
- ASSERT_NOT_REACHED();
- delete this;
- }
-
- virtual void didFail(WebKit::WebFileError error)
- {
- ASSERT(m_callbacks);
- m_callbacks->didFail(error);
- delete this;
- }
-
- virtual bool shouldBlockUntilCompletion() const
- {
- return m_callbacks->shouldBlockUntilCompletion();
- }
-
-private:
- AsyncFileWriterClient* m_client;
- KURL m_path;
- WebKit::WebFileSystem* m_webFileSystem;
- OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks;
-};
-
void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->readMetadata(path, new FileWriterHelperCallbacks(client, path, m_webFileSystem, callbacks));
+ OwnPtr<AsyncFileWriterChromium> asyncFileWriter = AsyncFileWriterChromium::create(client);
+ WebKit::WebFileWriterClient* writerClient = asyncFileWriter.get();
+
+ m_webFileSystem->createFileWriter(path, writerClient, new WebKit::WebFileSystemCallbacksImpl(callbacks, asyncFileWriter.release()));
abarth-chromium 2013/07/12 22:53:48 scary "naked" new. We need to fix that about the
kinuko 2013/07/16 02:35:22 Yep... this needs API fix, I'd like to address the
}
void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
« no previous file with comments | « no previous file | Source/web/AsyncFileWriterChromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698