[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:23:57 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 5901d18ea758873aa748eee976422e414ca289dc
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 14 06:06:59 2010 +0000

    2010-09-13  Eric Uhrhane  <ericu at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Add Chromium API for FileWriter
            https://bugs.webkit.org/show_bug.cgi?id=44360
    
            Build file changes.
            * WebKit.gyp:
    
            Added a way to get a WebFileWriter.
            * public/WebFileSystem.h:
            (WebKit::WebFileSystem::createFileWriter):
    
            WebFileWriter writes and truncates files.
            * public/WebFileWriter.h: Added.
    
            WebFileWriterClient reports success/failure and progress events.
            * public/WebFileWriterClient.h: Added.
    
            AsyncFileWriterChromium is a connector that links FileWriter and WebFileWriter, FileWriterClient and WebFileWriterClient.
            * src/AsyncFileWriterChromium.cpp: Added.
            * src/AsyncFileWriterChromium.h: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67446 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index f11256b..972af28 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,27 @@
+2010-09-13  Eric Uhrhane  <ericu at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Add Chromium API for FileWriter
+        https://bugs.webkit.org/show_bug.cgi?id=44360
+
+        Build file changes.
+        * WebKit.gyp:
+
+        Added a way to get a WebFileWriter.
+        * public/WebFileSystem.h:
+        (WebKit::WebFileSystem::createFileWriter):
+
+        WebFileWriter writes and truncates files.
+        * public/WebFileWriter.h: Added.
+
+        WebFileWriterClient reports success/failure and progress events.
+        * public/WebFileWriterClient.h: Added.
+
+        AsyncFileWriterChromium is a connector that links FileWriter and WebFileWriter, FileWriterClient and WebFileWriterClient.
+        * src/AsyncFileWriterChromium.cpp: Added.
+        * src/AsyncFileWriterChromium.h: Added.
+
 2010-09-13  W. James MacLean  <wjmaclean at google.com>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 517e58c..cd1ba28 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -153,6 +153,8 @@
                 'public/WebFileSystemCallbacks.h',
                 'public/WebFileSystemEntry.h',
                 'public/WebFileUtilities.h',
+                'public/WebFileWriter.h',
+                'public/WebFileWriterClient.h',
                 'public/WebFindOptions.h',
                 'public/WebFloatPoint.h',
                 'public/WebFloatRect.h',
@@ -280,6 +282,8 @@
                 'src/AssertMatchingEnums.cpp',
                 'src/AsyncFileSystemChromium.cpp',
                 'src/AsyncFileSystemChromium.h',
+                'src/AsyncFileWriterChromium.cpp',
+                'src/AsyncFileWriterChromium.h',
                 'src/AutoFillPopupMenuClient.cpp',
                 'src/AutoFillPopupMenuClient.h',
                 'src/BackForwardListClientImpl.cpp',
diff --git a/WebKit/chromium/public/WebFileSystem.h b/WebKit/chromium/public/WebFileSystem.h
index 641c169..b21235d 100644
--- a/WebKit/chromium/public/WebFileSystem.h
+++ b/WebKit/chromium/public/WebFileSystem.h
@@ -37,6 +37,8 @@
 namespace WebKit {
 
 class WebFileSystemCallbacks;
+class WebFileWriter;
+class WebFileWriterClient;
 
 class WebFileSystem {
 public:
@@ -100,6 +102,10 @@ public:
     // WebFileSystemCallbacks::didFail() must be called otherwise.
     virtual void readDirectory(const WebString& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); }
 
+    // Creates a WebFileWriter that can be used to write to the given file.
+    // This is a fast, synchronous call, and should not stat the filesystem.
+    virtual WebFileWriter* createFileWriter(const WebString& path, WebFileWriterClient*) { WEBKIT_ASSERT_NOT_REACHED(); return 0; }
+
 protected:
     virtual ~WebFileSystem() { }
 };
diff --git a/WebKit/chromium/public/WebFileWriter.h b/WebKit/chromium/public/WebFileWriter.h
new file mode 100644
index 0000000..9cde098
--- /dev/null
+++ b/WebKit/chromium/public/WebFileWriter.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebFileWriter_h
+#define WebFileWriter_h
+
+#include "WebCommon.h"
+#include "WebString.h"
+
+namespace WebKit {
+
+class WebURL;
+
+class WebFileWriter {
+public:
+    virtual ~WebFileWriter() { }
+
+    // Only one write or one truncate operation can be in progress at a time.
+    // These functions are asynchronous and will report results through the WebFileWriter's associated WebFileWriterClient.
+    virtual void write(long long position, const WebURL& blobURL) = 0;
+    virtual void truncate(long long length) = 0;
+
+    // Cancel will attempt to abort a running write or truncate.  However, it may not be possible to cancel an in-progress action, or the call may have come in too late.  Partial writes are possible.
+    // Do not call cancel when there is no write or truncate in progress.
+    virtual void cancel() = 0;
+};
+    
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebFileWriterClient.h b/WebKit/chromium/public/WebFileWriterClient.h
new file mode 100644
index 0000000..d371582
--- /dev/null
+++ b/WebKit/chromium/public/WebFileWriterClient.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebFileWriterClient_h
+#define WebFileWriterClient_h
+
+#include "WebCommon.h"
+#include "WebFileError.h"
+
+namespace WebKit {
+
+class WebFileWriterClient {
+public:
+    // Called for each chunk of a write, to indicate progress.
+    // On the final chunk, when the write is finished, complete will be true.
+    virtual void didWrite(long long bytes, bool complete) = 0;
+
+    // Called once when the truncate completes successfully.
+    virtual void didTruncate(long long length) = 0;
+
+    // Called if the write or truncate fails, or if it is cancelled before the write or truncate completes.  Completion of an operation will be signalled exactly once, either by didFail, didTruncate, or didWrite(..., true).
+    virtual void didFail(WebFileError) = 0;
+
+protected:
+    virtual ~WebFileWriterClient() { }
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.cpp b/WebKit/chromium/src/AsyncFileWriterChromium.cpp
new file mode 100644
index 0000000..157f63c
--- /dev/null
+++ b/WebKit/chromium/src/AsyncFileWriterChromium.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AsyncFileWriterChromium.h"
+
+#if ENABLE(FILE_WRITER)
+
+#include "Blob.h"
+#include "FileWriterClient.h"
+#include "WebFileWriter.h"
+#include "WebURL.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+AsyncFileWriterChromium::AsyncFileWriterChromium(FileWriterClient* client)
+    : m_client(client)
+{
+}
+
+void AsyncFileWriterChromium::setWebFileWriter(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()));
+}
+
+void AsyncFileWriterChromium::truncate(long long length)
+{
+    ASSERT(m_writer);
+    m_writer->truncate(length);
+}
+
+void AsyncFileWriterChromium::abort()
+{
+    ASSERT(m_writer);
+    m_writer->cancel();
+}
+
+void AsyncFileWriterChromium::didWrite(long long bytes, bool complete)
+{
+    ASSERT(m_writer);
+    m_client->didWrite(bytes, complete);
+}
+
+void AsyncFileWriterChromium::didTruncate(long long length)
+{
+    m_client->didTruncate(length);
+}
+
+void AsyncFileWriterChromium::didFail(WebFileError error)
+{
+    m_client->didFail(error);
+}
+
+} // namespace
+
+#endif // ENABLE(FILE_WRITER)
diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.h b/WebKit/chromium/src/AsyncFileWriterChromium.h
new file mode 100644
index 0000000..d1d5c7d
--- /dev/null
+++ b/WebKit/chromium/src/AsyncFileWriterChromium.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AsyncFileWriterChromium_h
+#define AsyncFileWriterChromium_h
+
+#if ENABLE(FILE_WRITER)
+
+#include "AsyncFileWriter.h"
+#include "WebFileError.h"
+#include "WebFileWriterClient.h"
+
+namespace WebCore {
+class Blob;
+class FileWriterClient;
+}
+
+namespace WebKit {
+
+class WebFileWriter;
+
+class AsyncFileWriterChromium : public WebCore::AsyncFileWriter, public WebFileWriterClient {
+public:
+    AsyncFileWriterChromium(WebCore::FileWriterClient* client);
+    ~AsyncFileWriterChromium();
+
+    void setWebFileWriter(WebFileWriter* writer);
+
+    // FileWriter
+    virtual void write(long long position, WebCore::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);
+
+private:
+    OwnPtr<WebFileWriter> m_writer;
+    WebCore::FileWriterClient* m_client;
+};
+
+} // namespace
+
+#endif // ENABLE(FILE_WRITER)
+
+#endif // AsyncFileWriterChromium_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list