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

jianli at chromium.org jianli at chromium.org
Wed Dec 22 12:18:43 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 04568245acdf4f4860b05b8333b50a56fdbd7e1e
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 18 22:48:25 2010 +0000

    WebCore: Chromium side implementation of blob data and blob registry.
    https://bugs.webkit.org/show_bug.cgi?id=43871
    
    Reviewed by Darin Fisher.
    
    Wrap !PLATFORM(CHROMIUM) around blobRegistry() so that chromium uses the
    implementation in WebKit Chromium.
    
    * platform/network/BlobRegistryImpl.cpp:
    
    WebKit/chromium: [chromium] Chromium side implementation of blob data and blob registry.
    https://bugs.webkit.org/show_bug.cgi?id=43871
    
    Reviewed by Darin Fisher.
    
    * WebKit.gyp:
    * public/WebBlobData.h: Added.
    * public/WebBlobRegistry.h: Added.
    * public/WebBlobStorageData.h: Added.
    * public/WebKitClient.h:
    (WebKit::WebKitClient::blobRegistry):
    * src/BlobRegistryProxy.cpp: Added.
    * src/BlobRegistryProxy.h: Added.
    * src/WebBlobData.cpp: Added.
    * src/WebBlobRegistryImpl.cpp: Added.
    * src/WebBlobRegistryImpl.h: Added.
    * src/WebBlobStorageData.cpp: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65637 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3983756..e55b1c4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-18  Jian Li  <jianli at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Chromium side implementation of blob data and blob registry.
+        https://bugs.webkit.org/show_bug.cgi?id=43871
+
+        Wrap !PLATFORM(CHROMIUM) around blobRegistry() so that chromium uses the
+        implementation in WebKit Chromium.
+
+        * platform/network/BlobRegistryImpl.cpp:
+
 2010-08-18  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/WebCore/platform/network/BlobRegistryImpl.cpp b/WebCore/platform/network/BlobRegistryImpl.cpp
index dac96ea..00c0b75 100644
--- a/WebCore/platform/network/BlobRegistryImpl.cpp
+++ b/WebCore/platform/network/BlobRegistryImpl.cpp
@@ -42,12 +42,14 @@
 
 namespace WebCore {
 
+#if !PLATFORM(CHROMIUM)
 BlobRegistry& blobRegistry()
 {
     ASSERT(isMainThread());
     DEFINE_STATIC_LOCAL(BlobRegistryImpl, instance, ());
     return instance;
 }
+#endif
 
 bool BlobRegistryImpl::shouldLoadResource(const ResourceRequest& request) const
 {
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 94599c0..829705e 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,23 @@
+2010-08-18  Jian Li  <jianli at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [chromium] Chromium side implementation of blob data and blob registry.
+        https://bugs.webkit.org/show_bug.cgi?id=43871
+
+        * WebKit.gyp:
+        * public/WebBlobData.h: Added.
+        * public/WebBlobRegistry.h: Added.
+        * public/WebBlobStorageData.h: Added.
+        * public/WebKitClient.h:
+        (WebKit::WebKitClient::blobRegistry):
+        * src/BlobRegistryProxy.cpp: Added.
+        * src/BlobRegistryProxy.h: Added.
+        * src/WebBlobData.cpp: Added.
+        * src/WebBlobRegistryImpl.cpp: Added.
+        * src/WebBlobRegistryImpl.h: Added.
+        * src/WebBlobStorageData.cpp: Added.
+
 2010-08-18  Dumitru Daniliuc  <dumi at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index e509f70..4d93071 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -119,6 +119,9 @@
                 'public/WebApplicationCacheHostClient.h',
                 'public/WebAttribute.h',
                 'public/WebBindings.h',
+                'public/WebBlobData.h',
+                'public/WebBlobRegistry.h',
+                'public/WebBlobStorageData.h',
                 'public/WebCache.h',
                 'public/WebCanvas.h',
                 'public/WebClipboard.h',
@@ -291,6 +294,8 @@
                 'src/AutoFillPopupMenuClient.h',
                 'src/BackForwardListClientImpl.cpp',
                 'src/BackForwardListClientImpl.h',
+                'src/BlobRegistryProxy.cpp',
+                'src/BlobRegistryProxy.h',
                 'src/BoundObject.cpp',
                 'src/BoundObject.h',
                 'src/ChromeClientImpl.cpp',
@@ -379,6 +384,10 @@
                 'src/WebAnimationControllerImpl.h',
                 'src/WebAttribute.cpp',
                 'src/WebBindings.cpp',
+                'src/WebBlobData.cpp',
+                'src/WebBlobRegistryImpl.cpp',
+                'src/WebBlobRegistryImpl.h',
+                'src/WebBlobStorageData.cpp',
                 'src/WebCache.cpp',
                 'src/WebColor.cpp',
                 'src/WebCommon.cpp',
diff --git a/WebKit/chromium/public/WebBlobData.h b/WebKit/chromium/public/WebBlobData.h
new file mode 100644
index 0000000..893aa89
--- /dev/null
+++ b/WebKit/chromium/public/WebBlobData.h
@@ -0,0 +1,100 @@
+/*
+ * 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 WebBlobData_h
+#define WebBlobData_h
+
+#include "WebData.h"
+#include "WebString.h"
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore { class BlobData; }
+namespace WTF { template <typename T> class PassOwnPtr; }
+#endif
+
+namespace WebKit {
+
+class WebBlobDataPrivate;
+
+class WebBlobData {
+public:
+    struct Item {
+        enum { TypeData, TypeFile, TypeBlob } type;
+        WebData data;
+        WebString pathOrURL;
+        long long offset;
+        long long length; // -1 means go to the end of the file/blob.
+        double expectedModificationTime; // 0.0 means that the time is not set.
+    };
+
+    ~WebBlobData() { reset(); }
+
+    WebBlobData() : m_private(0) { }
+
+    WEBKIT_API void initialize();
+    WEBKIT_API void reset();
+
+    bool isNull() const { return !m_private; }
+
+    // Returns the number of items.
+    WEBKIT_API size_t itemCount() const;
+
+    // Retrieves the values of the item at the given index.  Returns false if
+    // index is out of bounds.
+    WEBKIT_API bool itemAt(size_t index, Item& result) const;
+
+    // Appends to the list of items.
+    WEBKIT_API void appendData(const WebData&);
+    WEBKIT_API void appendFile(const WebString& filePath);
+    WEBKIT_API void appendFile(const WebString& filePath, long long offset, long long length, double expectedModificationTime);
+    WEBKIT_API void appendBlob(const WebString& blobURL, long long offset, long long length);
+
+    WEBKIT_API WebString contentType() const;
+    WEBKIT_API void setContentType(const WebString&);
+
+    WEBKIT_API WebString contentDisposition() const;
+    WEBKIT_API void setContentDisposition(const WebString&);
+
+#if WEBKIT_IMPLEMENTATION
+    WebBlobData(const WTF::PassOwnPtr<WebCore::BlobData>&);
+    WebBlobData& operator=(const WTF::PassOwnPtr<WebCore::BlobData>&);
+    operator WTF::PassOwnPtr<WebCore::BlobData>();
+#endif
+
+private:
+#if WEBKIT_IMPLEMENTATION
+    void assign(const WTF::PassOwnPtr<WebCore::BlobData>&);
+#endif
+    WebBlobDataPrivate* m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebBlobData_h
diff --git a/WebKit/chromium/public/WebBlobRegistry.h b/WebKit/chromium/public/WebBlobRegistry.h
new file mode 100644
index 0000000..35e9869
--- /dev/null
+++ b/WebKit/chromium/public/WebBlobRegistry.h
@@ -0,0 +1,59 @@
+/*
+ * 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 WebBlobRegistry_h
+#define WebBlobRegistry_h
+
+#include "WebBlobStorageData.h"
+
+namespace WebKit {
+
+class WebBlobData;
+class WebURL;
+
+class WebBlobRegistry {
+public:
+    WEBKIT_API static WebBlobRegistry* create();
+
+    virtual ~WebBlobRegistry() { }
+
+    // Registers a blob URL referring to the specified blob data.
+    virtual void registerBlobURL(const WebURL&, WebBlobData&) = 0;
+    
+    // Registers a blob URL referring to the blob data identified by the specified srcURL.
+    virtual void registerBlobURL(const WebURL&, const WebURL& srcURL) = 0;
+
+    virtual void unregisterBlobURL(const WebURL&) = 0;
+    virtual WebBlobStorageData getBlobDataFromURL(const WebURL&) = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebBlobRegistry_h
diff --git a/WebKit/chromium/public/WebBlobStorageData.h b/WebKit/chromium/public/WebBlobStorageData.h
new file mode 100644
index 0000000..a9c0c8b
--- /dev/null
+++ b/WebKit/chromium/public/WebBlobStorageData.h
@@ -0,0 +1,83 @@
+/*
+ * 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 WebBlobStorageData_h
+#define WebBlobStorageData_h
+
+#include "WebBlobData.h"
+#include "WebData.h"
+#include "WebFileInfo.h"
+#include "WebString.h"
+
+#if WEBKIT_IMPLEMENTATION
+namespace WebCore { class BlobStorageData; }
+namespace WTF { template <typename T> class PassRefPtr; }
+#endif
+
+namespace WebKit {
+
+class WebBlobStorageDataPrivate;
+
+class WebBlobStorageData {
+public:
+    ~WebBlobStorageData() { reset(); }
+
+    WebBlobStorageData() : m_private(0) { }
+
+    WEBKIT_API void reset();
+
+    bool isNull() const { return !m_private; }
+
+    // Returns the number of items.
+    WEBKIT_API size_t itemCount() const;
+
+    // Retrieves the values of the item at the given index. Returns false if
+    // index is out of bounds.
+    WEBKIT_API bool itemAt(size_t index, WebBlobData::Item& result) const;
+
+    WEBKIT_API WebString contentType() const;
+    WEBKIT_API WebString contentDisposition() const;
+
+#if WEBKIT_IMPLEMENTATION
+    WebBlobStorageData(const WTF::PassRefPtr<WebCore::BlobStorageData>&);
+    WebBlobStorageData& operator=(const WTF::PassRefPtr<WebCore::BlobStorageData>&);
+    operator WTF::PassRefPtr<WebCore::BlobStorageData>() const;
+#endif
+
+private:
+#if WEBKIT_IMPLEMENTATION
+    void assign(const WTF::PassRefPtr<WebCore::BlobStorageData>&);
+#endif
+    WebBlobStorageDataPrivate* m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebBlobStorageData_h
diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h
index 4104175..30f7c9f 100644
--- a/WebKit/chromium/public/WebKitClient.h
+++ b/WebKit/chromium/public/WebKitClient.h
@@ -48,6 +48,7 @@ namespace WebKit {
 
 class WebApplicationCacheHost;
 class WebApplicationCacheHostClient;
+class WebBlobRegistry;
 class WebClipboard;
 class WebCookieJar;
 class WebFileUtilities;
@@ -89,6 +90,11 @@ public:
     // May return null.
     virtual WebCookieJar* cookieJar() { return 0; }
 
+    // Blob ----------------------------------------------------------------
+
+    // Must return non-null.
+    virtual WebBlobRegistry* blobRegistry() { return 0; }
+
     // DOM Storage --------------------------------------------------
 
     // Return a LocalStorage namespace that corresponds to the following path.
diff --git a/WebKit/chromium/src/BlobRegistryProxy.cpp b/WebKit/chromium/src/BlobRegistryProxy.cpp
new file mode 100644
index 0000000..7bb430e
--- /dev/null
+++ b/WebKit/chromium/src/BlobRegistryProxy.cpp
@@ -0,0 +1,83 @@
+/*
+ * 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"
+
+#if ENABLE(BLOB)
+
+#include "BlobRegistryProxy.h"
+
+#include "BlobData.h"
+#include "KURL.h"
+#include "ResourceHandle.h"
+#include "WebBlobData.h"
+#include "WebBlobRegistry.h"
+#include "WebKit.h"
+#include "WebKitClient.h"
+#include "WebURL.h"
+#include <wtf/MainThread.h>
+#include <wtf/StdLibExtras.h>
+
+// We are part of the WebKit implementation.
+using namespace WebKit;
+
+namespace WebCore {
+
+BlobRegistry& blobRegistry()
+{
+    ASSERT(isMainThread());
+    DEFINE_STATIC_LOCAL(BlobRegistryProxy, instance, ());
+    return instance;
+}
+
+BlobRegistryProxy::BlobRegistryProxy()
+    : m_webBlobRegistry(WebKit::webKitClient()->blobRegistry())
+{
+}
+
+void BlobRegistryProxy::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData)
+{
+    WebBlobData webBlobData(blobData);
+    m_webBlobRegistry->registerBlobURL(url, webBlobData);
+}
+
+void BlobRegistryProxy::registerBlobURL(const KURL& url, const KURL& srcURL)
+{
+    m_webBlobRegistry->registerBlobURL(url, srcURL);
+}
+
+void BlobRegistryProxy::unregisterBlobURL(const KURL& url)
+{
+    m_webBlobRegistry->unregisterBlobURL(url);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebKit/chromium/src/BlobRegistryProxy.h b/WebKit/chromium/src/BlobRegistryProxy.h
new file mode 100644
index 0000000..6f2ebb2
--- /dev/null
+++ b/WebKit/chromium/src/BlobRegistryProxy.h
@@ -0,0 +1,63 @@
+/*
+ * 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 BlobRegistryProxy_h
+#define BlobRegistryProxy_h
+
+#if ENABLE(BLOB)
+
+#include "BlobRegistry.h"
+
+namespace WebKit { class WebBlobRegistry; }
+
+namespace WebCore {
+
+class BlobRegistryProxy : public BlobRegistry {
+public:
+    BlobRegistryProxy();
+
+    virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>);
+    virtual void registerBlobURL(const KURL&, const KURL& srcURL);
+    virtual void unregisterBlobURL(const KURL&);
+
+    virtual PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*) { return 0; }
+    virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data) { return false; }
+
+private:
+    virtual ~BlobRegistryProxy() { }
+
+    WebKit::WebBlobRegistry* m_webBlobRegistry;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(BLOB)
+
+#endif // BlobRegistryProxy_h
diff --git a/WebKit/chromium/src/WebBlobData.cpp b/WebKit/chromium/src/WebBlobData.cpp
new file mode 100644
index 0000000..7f30b1e
--- /dev/null
+++ b/WebKit/chromium/src/WebBlobData.cpp
@@ -0,0 +1,165 @@
+/*
+ * 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 "WebBlobData.h"
+
+#include "BlobData.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class WebBlobDataPrivate : public BlobData {
+};
+
+void WebBlobData::initialize()
+{
+    assign(BlobData::create());
+}
+
+void WebBlobData::reset()
+{
+    assign(0);
+}
+
+size_t WebBlobData::itemCount() const
+{
+    ASSERT(!isNull());
+    return m_private->items().size();
+}
+
+bool WebBlobData::itemAt(size_t index, Item& result) const
+{
+    ASSERT(!isNull());
+
+    if (index >= m_private->items().size())
+        return false;
+
+    const BlobDataItem& item = m_private->items()[index];
+    result.offset = item.offset;
+    result.length = item.length;
+    result.expectedModificationTime = item.expectedModificationTime;
+    switch (item.type) {
+    case BlobDataItem::Data:
+        result.type = Item::TypeData;
+        result.data.assign(item.data.data(), static_cast<size_t>(item.data.length()));
+        result.pathOrURL.reset();
+        return true;
+    case BlobDataItem::File:
+        result.type = Item::TypeFile;
+        result.data.reset();
+        result.pathOrURL = item.path;
+        return true;
+    case BlobDataItem::Blob:
+        result.type = Item::TypeBlob;
+        result.data.reset();
+        result.pathOrURL = item.url;
+        return true;
+    }
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+void WebBlobData::appendData(const WebData& data)
+{
+    ASSERT(!isNull());
+    m_private->appendData(CString(data.data(), data.size()));
+}
+
+void WebBlobData::appendFile(const WebString& filePath)
+{
+    ASSERT(!isNull());
+    m_private->appendFile(filePath);
+}
+
+void WebBlobData::appendFile(const WebString& filePath, long long offset, long long length, double expectedModificationTime)
+{
+    ASSERT(!isNull());
+    m_private->appendFile(filePath, offset, length, expectedModificationTime);
+}
+
+void WebBlobData::appendBlob(const WebString& blobURL, long long offset, long long length)
+{
+    ASSERT(!isNull());
+    m_private->appendBlob(KURL(ParsedURLString, blobURL), offset, length);
+}
+
+WebString WebBlobData::contentType() const
+{
+    ASSERT(!isNull());
+    return m_private->contentType();
+}
+
+void WebBlobData::setContentType(const WebString& contentType)
+{
+    ASSERT(!isNull());
+    m_private->setContentType(contentType);
+}
+
+WebString WebBlobData::contentDisposition() const
+{
+    ASSERT(!isNull());
+    return m_private->contentDisposition();
+}
+
+void WebBlobData::setContentDisposition(const WebString& contentDisposition)
+{
+    ASSERT(!isNull());
+    m_private->setContentDisposition(contentDisposition);
+}
+
+WebBlobData::WebBlobData(const PassOwnPtr<BlobData>& data)
+    : m_private(0)
+{
+    assign(data);
+}
+
+WebBlobData& WebBlobData::operator=(const PassOwnPtr<BlobData>& data)
+{
+    assign(data);
+    return *this;
+}
+
+WebBlobData::operator PassOwnPtr<BlobData>()
+{
+    WebBlobDataPrivate* temp = m_private;
+    m_private = 0;
+    return adoptPtr(temp);
+}
+
+void WebBlobData::assign(const PassOwnPtr<BlobData>& data)
+{
+    if (m_private)
+        delete m_private;
+    m_private = static_cast<WebBlobDataPrivate*>(data.leakPtr());
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebBlobRegistryImpl.cpp b/WebKit/chromium/src/WebBlobRegistryImpl.cpp
new file mode 100644
index 0000000..662c524
--- /dev/null
+++ b/WebKit/chromium/src/WebBlobRegistryImpl.cpp
@@ -0,0 +1,80 @@
+/*
+ * 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 "WebBlobRegistryImpl.h"
+
+#include "BlobRegistryImpl.h"
+#include "ResourceError.h"
+#include "WebBlobData.h"
+#include "WebURL.h"
+#include <wtf/MainThread.h>
+
+#if ENABLE(BLOB)
+
+namespace WebKit {
+
+WebBlobRegistry* WebBlobRegistry::create()
+{
+    return new WebBlobRegistryImpl();
+}
+
+WebBlobRegistryImpl::WebBlobRegistryImpl()
+    : m_blobRegistry(new WebCore::BlobRegistryImpl())
+{
+}
+
+WebBlobRegistryImpl::~WebBlobRegistryImpl()
+{
+}
+
+void WebBlobRegistryImpl::registerBlobURL(const WebURL& url, WebBlobData& blobData)
+{
+    m_blobRegistry->registerBlobURL(url, blobData);
+}
+
+void WebBlobRegistryImpl::registerBlobURL(const WebURL& url, const WebURL& srcURL)
+{
+    m_blobRegistry->registerBlobURL(url, srcURL);
+}
+
+void WebBlobRegistryImpl::unregisterBlobURL(const WebURL& url)
+{
+    m_blobRegistry->unregisterBlobURL(url);
+}
+
+WebBlobStorageData WebBlobRegistryImpl::getBlobDataFromURL(const WebURL& url)
+{
+    return m_blobRegistry->getBlobDataFromURL(url);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BLOB)
diff --git a/WebKit/chromium/src/WebBlobRegistryImpl.h b/WebKit/chromium/src/WebBlobRegistryImpl.h
new file mode 100644
index 0000000..da512db
--- /dev/null
+++ b/WebKit/chromium/src/WebBlobRegistryImpl.h
@@ -0,0 +1,61 @@
+/*
+ * 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 WebBlobRegistryImpl_h
+#define WebBlobRegistryImpl_h
+
+#if ENABLE(BLOB)
+
+#include "WebBlobRegistry.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebCore { class BlobRegistryImpl; }
+
+namespace WebKit {
+
+class WebBlobRegistryImpl : public WebBlobRegistry {
+public:
+    WebBlobRegistryImpl();
+    virtual ~WebBlobRegistryImpl();
+
+    virtual void registerBlobURL(const WebURL&, WebBlobData&);
+    virtual void registerBlobURL(const WebURL&, const WebURL& srcURL);
+    virtual void unregisterBlobURL(const WebURL&);
+    virtual WebBlobStorageData getBlobDataFromURL(const WebURL&);
+
+private:
+    WTF::OwnPtr<WebCore::BlobRegistryImpl> m_blobRegistry;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BLOB)
+
+#endif // WebBlobRegistryImpl_h
diff --git a/WebKit/chromium/src/WebBlobStorageData.cpp b/WebKit/chromium/src/WebBlobStorageData.cpp
new file mode 100644
index 0000000..7e3b08e
--- /dev/null
+++ b/WebKit/chromium/src/WebBlobStorageData.cpp
@@ -0,0 +1,115 @@
+/*
+ * 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 "WebBlobStorageData.h"
+
+#include "BlobStorageData.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class WebBlobStorageDataPrivate : public BlobStorageData {
+};
+
+void WebBlobStorageData::reset()
+{
+    assign(0);
+}
+
+size_t WebBlobStorageData::itemCount() const
+{
+    ASSERT(!isNull());
+    return m_private->items().size();
+}
+
+bool WebBlobStorageData::itemAt(size_t index, WebBlobData::Item& result) const
+{
+    ASSERT(!isNull());
+
+    if (index >= m_private->items().size())
+        return false;
+
+    const BlobDataItem& item = m_private->items()[index];
+    result.offset = item.offset;
+    result.length = item.length;
+    result.expectedModificationTime = item.expectedModificationTime;
+    switch (item.type) {
+    case BlobDataItem::Data:
+        result.type = WebBlobData::Item::TypeData;
+        result.data.assign(item.data.data(), static_cast<size_t>(item.data.length()));
+        return true;
+    case BlobDataItem::File:
+        result.type = WebBlobData::Item::TypeFile;
+        result.pathOrURL = item.path;
+        return true;
+    }
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+WebString WebBlobStorageData::contentType() const
+{
+    ASSERT(!isNull());
+    return m_private->contentType();
+}
+
+WebString WebBlobStorageData::contentDisposition() const
+{
+    ASSERT(!isNull());
+    return m_private->contentDisposition();
+}
+
+WebBlobStorageData::WebBlobStorageData(const PassRefPtr<BlobStorageData>& data)
+    : m_private(0)
+{
+    assign(data);
+}
+
+WebBlobStorageData& WebBlobStorageData::operator=(const PassRefPtr<BlobStorageData>& data)
+{
+    assign(data);
+    return *this;
+}
+
+WebBlobStorageData::operator PassRefPtr<BlobStorageData>() const
+{
+    return m_private;
+}
+
+void WebBlobStorageData::assign(const PassRefPtr<BlobStorageData>& data)
+{
+    if (m_private)
+        m_private->deref();
+    m_private = static_cast<WebBlobStorageDataPrivate*>(data.leakRef());
+}
+
+} // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list