[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 13:40:19 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b12498d547688af984de4c5e96ef47cac3682d8b
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 23 00:07:46 2010 +0000

    2010-09-22  Eric Uhrhane  <ericu at chromium.org>
    
            Reviewed by Dumitru Daniliuc.
    
            Add Chromium implementation for FileWriter
            https://bugs.webkit.org/show_bug.cgi?id=44361
    
            No new tests; the implementation's not yet far enough along for that.
    
            This makes a chain of contruction-and-linking-up for various sorts of
            FileWriter interfaces to call through to Chromium, and for various
            sorts of FileWriterClients to call back, with object ownership always
            pointing towards the Chromium API.  That is, the DOM object owns an
            AsyncFileWriter, which owns its implementation object, and the reverse
            (client) direction is raw pointers.
    
            File metadata is looked up before the FileWriter is returned, so that
            we know the file exists and can cache its length.
    
            The WebCore part of this is simple and generic enough to handle
            Chromium, so it should be easy for me to put in a WebCore-only
            implementation next.
    
            * fileapi/AsyncFileWriter.h:
            * fileapi/DOMFileSystem.cpp:
            (WebCore::DOMFileSystem::createWriter):
            * fileapi/DOMFileSystem.h:
            * fileapi/FileSystemCallbacks.cpp:
            (WebCore::FileSystemCallbacksBase::didCreateFileWriter):
            (WebCore::FileWriterCallbacks::FileWriterCallbacks):
            (WebCore::FileWriterCallbacks::didCreateFileWriter):
            * fileapi/FileSystemCallbacks.h:
            * platform/AsyncFileSystem.h:
            * platform/AsyncFileSystemCallbacks.h:
    2010-09-22  Eric Uhrhane  <ericu at chromium.org>
    
            Reviewed by Dumitru Daniliuc.
    
            Add Chromium implementation for FileWriter
            https://bugs.webkit.org/show_bug.cgi?id=44361
    
            No new tests; the implementation's not yet far enough along for that.
    
            This makes a chain of construction-and-linking-up for various sorts of
            FileWriter interfaces to call through to Chromium, and for various
            sorts of FileWriterClients to call back, with object ownership always
            pointing towards the Chromium API.  That is, the DOM object owns an
            AsyncFileWriter, which owns its implementation object, and the reverse
            (client) direction is raw pointers.
    
            File metadata is looked up before the FileWriter is returned, so that
            we know the file exists and can cache its length.
    
            The WebKit/chromium interface here is modeled after that of the
            FileSystem.
    
            * public/WebFileInfo.h:
            (WebKit::WebFileInfo::WebFileInfo):
            * src/AsyncFileSystemChromium.cpp:
            (WebCore::FileWriterHelperCallbacks::FileWriterHelperCallbacks):
            (WebCore::FileWriterHelperCallbacks::didSucceed):
            (WebCore::FileWriterHelperCallbacks::didReadMetadata):
            (WebCore::FileWriterHelperCallbacks::didReadDirectory):
            (WebCore::FileWriterHelperCallbacks::didOpenFileSystem):
            (WebCore::FileWriterHelperCallbacks::didCreateFileWriter):
            (WebCore::FileWriterHelperCallbacks::didFail):
            (WebCore::AsyncFileSystemChromium::createWriter):
            * src/AsyncFileSystemChromium.h:
            * src/AsyncFileWriterChromium.cpp:
            (WebCore::AsyncFileWriterChromium::setWebFileWriter):
            (WebCore::AsyncFileWriterChromium::write):
            (WebCore::AsyncFileWriterChromium::didFail):
            * src/AsyncFileWriterChromium.h:
            * src/WebFileSystemCallbacksImpl.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68101 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 38d3110..281f62b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,38 @@
+2010-09-22  Eric Uhrhane  <ericu at chromium.org>
+
+        Reviewed by Dumitru Daniliuc.
+
+        Add Chromium implementation for FileWriter
+        https://bugs.webkit.org/show_bug.cgi?id=44361
+
+        No new tests; the implementation's not yet far enough along for that.
+
+        This makes a chain of contruction-and-linking-up for various sorts of
+        FileWriter interfaces to call through to Chromium, and for various
+        sorts of FileWriterClients to call back, with object ownership always
+        pointing towards the Chromium API.  That is, the DOM object owns an
+        AsyncFileWriter, which owns its implementation object, and the reverse
+        (client) direction is raw pointers.
+
+        File metadata is looked up before the FileWriter is returned, so that
+        we know the file exists and can cache its length.
+
+        The WebCore part of this is simple and generic enough to handle
+        Chromium, so it should be easy for me to put in a WebCore-only
+        implementation next.
+        
+        * fileapi/AsyncFileWriter.h:
+        * fileapi/DOMFileSystem.cpp:
+        (WebCore::DOMFileSystem::createWriter):
+        * fileapi/DOMFileSystem.h:
+        * fileapi/FileSystemCallbacks.cpp:
+        (WebCore::FileSystemCallbacksBase::didCreateFileWriter):
+        (WebCore::FileWriterCallbacks::FileWriterCallbacks):
+        (WebCore::FileWriterCallbacks::didCreateFileWriter):
+        * fileapi/FileSystemCallbacks.h:
+        * platform/AsyncFileSystem.h:
+        * platform/AsyncFileSystemCallbacks.h:
+
 2010-09-22  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/fileapi/AsyncFileWriter.h b/WebCore/fileapi/AsyncFileWriter.h
index ff6c1fa..c1a47c5 100644
--- a/WebCore/fileapi/AsyncFileWriter.h
+++ b/WebCore/fileapi/AsyncFileWriter.h
@@ -45,8 +45,6 @@ class AsyncFileWriter {
 public:
     virtual ~AsyncFileWriter() {}
 
-    virtual void setFileWriterClient(FileWriterClient* client) = 0;
-
     virtual void write(long long position, Blob* data) = 0;
     virtual void truncate(long long length) = 0;
     virtual void abort() = 0;
diff --git a/WebCore/fileapi/DOMFileSystem.cpp b/WebCore/fileapi/DOMFileSystem.cpp
index a8a7e6b..afd3e1e 100644
--- a/WebCore/fileapi/DOMFileSystem.cpp
+++ b/WebCore/fileapi/DOMFileSystem.cpp
@@ -40,8 +40,11 @@
 #include "Entry.h"
 #include "EntryCallback.h"
 #include "ErrorCallback.h"
+#include "FileEntry.h"
 #include "FileError.h"
 #include "FileSystemCallbacks.h"
+#include "FileWriter.h"
+#include "FileWriterCallback.h"
 #include "MetadataCallback.h"
 #include "ScriptExecutionContext.h"
 #include "VoidCallback.h"
@@ -199,6 +202,17 @@ void DOMFileSystem::getDirectory(const Entry* base, const String& path, PassRefP
         m_asyncFileSystem->directoryExists(platformPath, callbacks.release());
 }
 
+void DOMFileSystem::createWriter(const FileEntry* file, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+    ASSERT(file);
+
+    String platformPath = m_asyncFileSystem->virtualToPlatformPath(file->fullPath());
+
+    RefPtr<FileWriter> fileWriter = FileWriter::create(scriptExecutionContext());
+    OwnPtr<FileWriterCallbacks> callbacks = adoptPtr(new FileWriterCallbacks(fileWriter, successCallback, errorCallback));
+    m_asyncFileSystem->createWriter(fileWriter.get(), platformPath, callbacks.release());
+}
+
 void DOMFileSystem::readDirectory(const String& path, PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
 {
     ASSERT(DOMFilePath::isAbsolute(path));
diff --git a/WebCore/fileapi/DOMFileSystem.h b/WebCore/fileapi/DOMFileSystem.h
index f779aba..881ffc5 100644
--- a/WebCore/fileapi/DOMFileSystem.h
+++ b/WebCore/fileapi/DOMFileSystem.h
@@ -48,6 +48,8 @@ class Entry;
 class EntryCallback;
 class EntriesCallback;
 class ErrorCallback;
+class FileEntry;
+class FileWriterCallback;
 class MetadataCallback;
 class VoidCallback;
 
@@ -77,6 +79,7 @@ public:
     void getFile(const Entry* base, const String& path, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
     void getDirectory(const Entry* base, const String& path, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
     void readDirectory(const String& path, PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>);
+    void createWriter(const FileEntry* file, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>);
 
     // Schedule a callback. This should not cross threads (should be called on the same context thread).
     template <typename CB, typename CBArg>
diff --git a/WebCore/fileapi/FileSystemCallbacks.cpp b/WebCore/fileapi/FileSystemCallbacks.cpp
index d59e47a..fcc860f 100644
--- a/WebCore/fileapi/FileSystemCallbacks.cpp
+++ b/WebCore/fileapi/FileSystemCallbacks.cpp
@@ -34,6 +34,7 @@
 #if ENABLE(FILE_SYSTEM)
 
 #include "AsyncFileSystem.h"
+#include "AsyncFileWriter.h"
 #include "DOMFilePath.h"
 #include "DOMFileSystem.h"
 #include "DirectoryEntry.h"
@@ -45,6 +46,8 @@
 #include "FileEntry.h"
 #include "FileError.h"
 #include "FileSystemCallback.h"
+#include "FileWriter.h"
+#include "FileWriterCallback.h"
 #include "Metadata.h"
 #include "MetadataCallback.h"
 #include "ScriptExecutionContext.h"
@@ -91,6 +94,12 @@ void FileSystemCallbacksBase::didReadDirectoryEntry(const String&, bool)
     ASSERT_NOT_REACHED();
 }
 
+void FileSystemCallbacksBase::didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long)
+{
+    // Each subclass must implement an appropriate one.
+    ASSERT_NOT_REACHED();
+}
+
 void FileSystemCallbacksBase::didFail(int code)
 {
     if (m_errorCallback) {
@@ -187,6 +196,23 @@ void MetadataCallbacks::didReadMetadata(double modificationTime)
     m_successCallback.clear();
 }
 
+// FileWriterCallbacks ----------------------------------------------------------
+
+FileWriterCallbacks::FileWriterCallbacks(PassRefPtr<FileWriter> fileWriter, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+    : FileSystemCallbacksBase(errorCallback)
+    , m_fileWriter(fileWriter)
+    , m_successCallback(successCallback)
+{
+}
+
+void FileWriterCallbacks::didCreateFileWriter(PassOwnPtr<AsyncFileWriter> asyncFileWriter, long long length)
+{
+    m_fileWriter->initialize(asyncFileWriter, length);
+    if (m_successCallback)
+        m_successCallback->handleEvent(m_fileWriter.release().get());
+    m_successCallback.clear();
+}
+
 // VoidCallbacks --------------------------------------------------------------
 
 VoidCallbacks::VoidCallbacks(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
diff --git a/WebCore/fileapi/FileSystemCallbacks.h b/WebCore/fileapi/FileSystemCallbacks.h
index 31a2a0c..a5e9560 100644
--- a/WebCore/fileapi/FileSystemCallbacks.h
+++ b/WebCore/fileapi/FileSystemCallbacks.h
@@ -40,12 +40,15 @@
 
 namespace WebCore {
 
+class AsyncFileWriter;
 class DOMFileSystem;
 class ErrorCallback;
 class EntriesCallback;
 class EntryArray;
 class EntryCallback;
 class FileSystemCallback;
+class FileWriter;
+class FileWriterCallback;
 class MetadataCallback;
 class ScriptExecutionContext;
 class VoidCallback;
@@ -67,6 +70,9 @@ public:
     virtual void didReadDirectoryEntry(const String& name, bool isDirectory);
     virtual void didReadDirectoryEntries(bool hasMore);
 
+    // For createFileWriter.
+    virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long length);
+
     // For ErrorCallback.
     virtual void didFail(int code);
 
@@ -121,6 +127,16 @@ private:
     RefPtr<MetadataCallback> m_successCallback;
 };
 
+class FileWriterCallbacks : public FileSystemCallbacksBase {
+public:
+    FileWriterCallbacks(PassRefPtr<FileWriter>, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>);
+    virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long length);
+
+private:
+    RefPtr<FileWriter> m_fileWriter;
+    RefPtr<FileWriterCallback> m_successCallback;
+};
+
 class VoidCallbacks : public FileSystemCallbacksBase {
 public:
     VoidCallbacks(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>);
diff --git a/WebCore/platform/AsyncFileSystem.h b/WebCore/platform/AsyncFileSystem.h
index 601f0ea..600736b 100644
--- a/WebCore/platform/AsyncFileSystem.h
+++ b/WebCore/platform/AsyncFileSystem.h
@@ -41,6 +41,7 @@ namespace WebCore {
 
 class AsyncFileSystem;
 class AsyncFileSystemCallbacks;
+class FileWriterClient;
 
 // This class provides async interface for platform-specific file system implementation.  Note that all the methods take platform paths.
 class AsyncFileSystem : public Noncopyable {
@@ -107,6 +108,11 @@ public:
     // AsyncFileSystemCallbacks::didFail() is when there is an error.
     virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
 
+    // Creates an AsyncFileWriter for a given file path.
+    // AsyncFileSystemCallbacks::didCreateFileWriter() is called when an AsyncFileWriter is created successfully.
+    // AsyncFileSystemCallbacks::didFail() is called otherwise.
+    virtual void createWriter(FileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
+
     // Converts a given absolute virtual path to a platform path that starts with the platform root path of this file system.
     virtual String virtualToPlatformPath(const String& path) const;
 
diff --git a/WebCore/platform/AsyncFileSystemCallbacks.h b/WebCore/platform/AsyncFileSystemCallbacks.h
index 0547fad..451aead 100644
--- a/WebCore/platform/AsyncFileSystemCallbacks.h
+++ b/WebCore/platform/AsyncFileSystemCallbacks.h
@@ -38,6 +38,7 @@
 namespace WebCore {
 
 class AsyncFileSystem;
+class AsyncFileWriter;
 
 class AsyncFileSystemCallbacks : public Noncopyable {
 public:
@@ -56,6 +57,9 @@ public:
     // Called after a chunk of directory entries have been read (i.e. indicates it's good time to call back to the application).  If hasMore is true there can be more chunks.
     virtual void didReadDirectoryEntries(bool hasMore) = 0;
 
+    // Called when an AsyncFileWrter has been created successfully.
+    virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter> writer, long long length) = 0;
+
     // Called when there was an error.
     virtual void didFail(int code) = 0;
 
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 41ab08d..b5e7a19 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,44 @@
+2010-09-22  Eric Uhrhane  <ericu at chromium.org>
+
+        Reviewed by Dumitru Daniliuc.
+
+        Add Chromium implementation for FileWriter
+        https://bugs.webkit.org/show_bug.cgi?id=44361
+
+        No new tests; the implementation's not yet far enough along for that.
+
+        This makes a chain of construction-and-linking-up for various sorts of
+        FileWriter interfaces to call through to Chromium, and for various
+        sorts of FileWriterClients to call back, with object ownership always
+        pointing towards the Chromium API.  That is, the DOM object owns an
+        AsyncFileWriter, which owns its implementation object, and the reverse
+        (client) direction is raw pointers.
+
+        File metadata is looked up before the FileWriter is returned, so that
+        we know the file exists and can cache its length.
+
+        The WebKit/chromium interface here is modeled after that of the
+        FileSystem.
+        
+        * public/WebFileInfo.h:
+        (WebKit::WebFileInfo::WebFileInfo):
+        * src/AsyncFileSystemChromium.cpp:
+        (WebCore::FileWriterHelperCallbacks::FileWriterHelperCallbacks):
+        (WebCore::FileWriterHelperCallbacks::didSucceed):
+        (WebCore::FileWriterHelperCallbacks::didReadMetadata):
+        (WebCore::FileWriterHelperCallbacks::didReadDirectory):
+        (WebCore::FileWriterHelperCallbacks::didOpenFileSystem):
+        (WebCore::FileWriterHelperCallbacks::didCreateFileWriter):
+        (WebCore::FileWriterHelperCallbacks::didFail):
+        (WebCore::AsyncFileSystemChromium::createWriter):
+        * src/AsyncFileSystemChromium.h:
+        * src/AsyncFileWriterChromium.cpp:
+        (WebCore::AsyncFileWriterChromium::setWebFileWriter):
+        (WebCore::AsyncFileWriterChromium::write):
+        (WebCore::AsyncFileWriterChromium::didFail):
+        * src/AsyncFileWriterChromium.h:
+        * src/WebFileSystemCallbacksImpl.h:
+
 2010-09-22  Kenneth Russell  <kbr at google.com>
 
         Unreviewed, Chromium build fix. Fix build when accelerated
diff --git a/WebKit/chromium/public/WebFileInfo.h b/WebKit/chromium/public/WebFileInfo.h
index 4590a30..be0b3e4 100644
--- a/WebKit/chromium/public/WebFileInfo.h
+++ b/WebKit/chromium/public/WebFileInfo.h
@@ -38,7 +38,19 @@ struct WebFileInfo {
     // The value 0.0 means that the time is not set.
     double modificationTime;
 
-    WebFileInfo() : modificationTime(0.0) { }
+    // The length of the file in bytes.
+    // The value -1 means that the length is not set.
+    long long length;
+
+    enum Type {
+        TypeUnknown = 0,
+        TypeFile,
+        TypeDirectory
+    };
+
+    Type type;
+
+    WebFileInfo() : modificationTime(0.0), length(-1), type(TypeUnknown) { }
 };
 
 } // namespace WebKit
diff --git a/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/WebKit/chromium/src/AsyncFileSystemChromium.cpp
index 08fcea6..8911941 100644
--- a/WebKit/chromium/src/AsyncFileSystemChromium.cpp
+++ b/WebKit/chromium/src/AsyncFileSystemChromium.cpp
@@ -33,9 +33,11 @@
 #if ENABLE(FILE_SYSTEM)
 
 #include "AsyncFileSystemCallbacks.h"
-#include "FileSystem.h"
+#include "AsyncFileWriterChromium.h"
+#include "WebFileInfo.h"
 #include "WebFileSystem.h"
 #include "WebFileSystemCallbacksImpl.h"
+#include "WebFileWriter.h"
 #include "WebKit.h"
 #include "WebKitClient.h"
 
@@ -99,6 +101,65 @@ void AsyncFileSystemChromium::readDirectory(const String& path, PassOwnPtr<Async
     m_webFileSystem->readDirectory(path, new WebKit::WebFileSystemCallbacksImpl(callbacks));
 }
 
+class FileWriterHelperCallbacks : public WebKit::WebFileSystemCallbacks {
+public:
+    FileWriterHelperCallbacks(FileWriterClient* client, const String& 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 didReadDirectory(const WebKit::WebVector<WebKit::WebFileSystemEntry>& entries, bool hasMore)
+    {
+        ASSERT_NOT_REACHED();
+        delete this;
+    }
+    virtual void didOpenFileSystem(const WebKit::WebString& name, const WebKit::WebString& rootPath)
+    {
+        ASSERT_NOT_REACHED();
+        delete this;
+    }
+
+    virtual void didFail(WebKit::WebFileError error)
+    {
+        ASSERT(m_callbacks);
+        m_callbacks->didFail(error);
+        delete this;
+    }
+
+private:
+    FileWriterClient* m_client;
+    String m_path;
+    WebKit::WebFileSystem* m_webFileSystem;
+    OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks;
+};
+
+void AsyncFileSystemChromium::createWriter(FileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+    m_webFileSystem->readMetadata(path, new FileWriterHelperCallbacks(client, path, m_webFileSystem, callbacks));
+}
+
 } // namespace WebCore
 
 #endif
diff --git a/WebKit/chromium/src/AsyncFileSystemChromium.h b/WebKit/chromium/src/AsyncFileSystemChromium.h
index f46f78c..b20e7d4 100644
--- a/WebKit/chromium/src/AsyncFileSystemChromium.h
+++ b/WebKit/chromium/src/AsyncFileSystemChromium.h
@@ -58,6 +58,7 @@ public:
     virtual void fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
     virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
     virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
+    virtual void createWriter(FileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
 
 private:
     WebKit::WebFileSystem* m_webFileSystem;
diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.cpp b/WebKit/chromium/src/AsyncFileWriterChromium.cpp
index 4bfc988..7573cd2 100644
--- a/WebKit/chromium/src/AsyncFileWriterChromium.cpp
+++ b/WebKit/chromium/src/AsyncFileWriterChromium.cpp
@@ -38,25 +38,26 @@
 #include "WebFileWriter.h"
 #include "WebURL.h"
 
-using namespace WebCore;
-
-namespace WebKit {
+namespace WebCore {
 
 AsyncFileWriterChromium::AsyncFileWriterChromium(FileWriterClient* client)
     : m_client(client)
 {
 }
 
-void AsyncFileWriterChromium::setWebFileWriter(WebFileWriter* writer)
+AsyncFileWriterChromium::~AsyncFileWriterChromium()
+{
+}
+
+void AsyncFileWriterChromium::setWebFileWriter(PassOwnPtr<WebKit::WebFileWriter> writer)
 {
-    ASSERT(!m_writer);
     m_writer = writer;
 }
 
 void AsyncFileWriterChromium::write(long long position, Blob* data)
 {
     ASSERT(m_writer);
-    m_writer->write(position, WebURL(data->url()));
+    m_writer->write(position, WebKit::WebURL(data->url()));
 }
 
 void AsyncFileWriterChromium::truncate(long long length)
@@ -82,7 +83,7 @@ void AsyncFileWriterChromium::didTruncate(long long length)
     m_client->didTruncate(length);
 }
 
-void AsyncFileWriterChromium::didFail(WebFileError error)
+void AsyncFileWriterChromium::didFail(WebKit::WebFileError error)
 {
     m_client->didFail(error);
 }
diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.h b/WebKit/chromium/src/AsyncFileWriterChromium.h
index 92743ca..217c5b8 100644
--- a/WebKit/chromium/src/AsyncFileWriterChromium.h
+++ b/WebKit/chromium/src/AsyncFileWriterChromium.h
@@ -36,35 +36,37 @@
 #include "AsyncFileWriter.h"
 #include "WebFileError.h"
 #include "WebFileWriterClient.h"
+#include <WTF/PassOwnPtr.h>
 
-namespace WebCore {
-class Blob;
-class FileWriterClient;
+namespace WebKit {
+class WebFileWriter;
 }
 
-namespace WebKit {
+namespace WebCore {
 
-class WebFileWriter;
+class Blob;
+class FileWriterClient;
 
-class AsyncFileWriterChromium : public WebCore::AsyncFileWriter, public WebFileWriterClient {
+class AsyncFileWriterChromium : public AsyncFileWriter, public WebKit::WebFileWriterClient {
 public:
-    AsyncFileWriterChromium(WebCore::FileWriterClient* client);
-
-    void setWebFileWriter(WebFileWriter* writer);
+    AsyncFileWriterChromium(FileWriterClient* client);
+    ~AsyncFileWriterChromium();
+    
+    void setWebFileWriter(PassOwnPtr<WebKit::WebFileWriter> writer);
 
     // FileWriter
-    virtual void write(long long position, WebCore::Blob* data);
+    virtual void write(long long position, Blob* data);
     virtual void truncate(long long length);
     virtual void abort();
 
     // WebFileWriterClient
     virtual void didWrite(long long bytes, bool complete);
     virtual void didTruncate(long long length);
-    virtual void didFail(WebFileError);
+    virtual void didFail(WebKit::WebFileError);
 
 private:
-    OwnPtr<WebFileWriter> m_writer;
-    WebCore::FileWriterClient* m_client;
+    OwnPtr<WebKit::WebFileWriter> m_writer;
+    FileWriterClient* m_client;
 };
 
 } // namespace

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list