[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 14:32:31 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ab9f00026f9403494cc75efe708ace347d0127e2
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 12 22:16:16 2010 +0000

    [chromium] Update WebBlobData to adapt to BlobData change in terms of
    handling string data item.
    https://bugs.webkit.org/show_bug.cgi?id=47423
    
    Reviewed by Darin Fisher.
    
    Also remove unneeded methods in WebBlobData. WebBlobStorageData.* are
    also removed since they're not longer needed.
    
    * WebKit.gyp:
    * public/WebBlobData.h:
    * public/WebBlobRegistry.h:
    * public/WebBlobStorageData.h: Removed.
    * public/WebThreadSafeData.h: Added.
    * src/WebBlobData.cpp:
    * src/WebBlobStorageData.cpp: Removed.
    * src/WebThreadSafeData.cpp: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69611 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 07808be..611bda9 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,23 @@
+2010-10-12  Jian Li  <jianli at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [chromium] Update WebBlobData to adapt to BlobData change in terms of
+        handling string data item.
+        https://bugs.webkit.org/show_bug.cgi?id=47423
+
+        Also remove unneeded methods in WebBlobData. WebBlobStorageData.* are
+        also removed since they're not longer needed.
+
+        * WebKit.gyp:
+        * public/WebBlobData.h:
+        * public/WebBlobRegistry.h:
+        * public/WebBlobStorageData.h: Removed.
+        * public/WebThreadSafeData.h: Added.
+        * src/WebBlobData.cpp:
+        * src/WebBlobStorageData.cpp: Removed.
+        * src/WebThreadSafeData.cpp: Added.
+
 2010-10-12  Kavita Kanetkar  <kkanetkar at chromium.org>
 
         Reviewed by Dumitru Daniliuc.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index e13b83b..7486881 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -112,7 +112,6 @@
                 'public/WebBindings.h',
                 'public/WebBlobData.h',
                 'public/WebBlobRegistry.h',
-                'public/WebBlobStorageData.h',
                 'public/WebCache.h',
                 'public/WebCanvas.h',
                 'public/WebClipboard.h',
@@ -265,6 +264,7 @@
                 'public/WebTextDirection.h',
                 'public/WebTextInputType.h',
                 'public/WebTextRun.h',
+                'public/WebThreadSafeData.h',
                 'public/WebURL.h',
                 'public/WebURLError.h',
                 'public/WebURLLoader.h',
@@ -390,7 +390,6 @@
                 'src/WebAttribute.cpp',
                 'src/WebBindings.cpp',
                 'src/WebBlobData.cpp',
-                'src/WebBlobStorageData.cpp',
                 'src/WebCache.cpp',
                 'src/WebColor.cpp',
                 'src/WebCommon.cpp',
@@ -523,6 +522,7 @@
                 'src/WebStorageNamespaceImpl.h',
                 'src/WebString.cpp',
                 'src/WebTextRun.cpp',
+                'src/WebThreadSafeData.cpp',
                 'src/WebURL.cpp',
                 'src/WebURLLoadTiming.cpp',
                 'src/WebURLRequest.cpp',
diff --git a/WebKit/chromium/public/WebBlobData.h b/WebKit/chromium/public/WebBlobData.h
index 8c0e1aa..67b6cd6 100644
--- a/WebKit/chromium/public/WebBlobData.h
+++ b/WebKit/chromium/public/WebBlobData.h
@@ -31,7 +31,7 @@
 #ifndef WebBlobData_h
 #define WebBlobData_h
 
-#include "WebCString.h"
+#include "WebThreadSafeData.h"
 #include "WebString.h"
 #include "WebURL.h"
 
@@ -48,7 +48,7 @@ class WebBlobData {
 public:
     struct Item {
         enum { TypeData, TypeFile, TypeBlob } type;
-        WebCString data;
+        WebThreadSafeData data;
         WebString filePath;
         WebURL blobURL;
         long long offset;
@@ -72,17 +72,9 @@ public:
     // 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 WebCString&);
-    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 WebURL& 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>&);
diff --git a/WebKit/chromium/public/WebBlobRegistry.h b/WebKit/chromium/public/WebBlobRegistry.h
index cbd9a99..308d72e 100644
--- a/WebKit/chromium/public/WebBlobRegistry.h
+++ b/WebKit/chromium/public/WebBlobRegistry.h
@@ -31,8 +31,6 @@
 #ifndef WebBlobRegistry_h
 #define WebBlobRegistry_h
 
-#include "WebBlobStorageData.h"
-
 namespace WebKit {
 
 class WebBlobData;
diff --git a/WebKit/chromium/public/WebBlobStorageData.h b/WebKit/chromium/public/WebBlobStorageData.h
deleted file mode 100644
index a9c0c8b..0000000
--- a/WebKit/chromium/public/WebBlobStorageData.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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/WebThreadSafeData.h b/WebKit/chromium/public/WebThreadSafeData.h
new file mode 100755
index 0000000..a000b39
--- /dev/null
+++ b/WebKit/chromium/public/WebThreadSafeData.h
@@ -0,0 +1,77 @@
+/*
+ * 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 WebThreadSafeData_h
+#define WebThreadSafeData_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+
+#if !WEBKIT_IMPLEMENTATION
+#include <string>
+#endif
+
+namespace WebCore { class RawData; }
+
+namespace WebKit {
+
+// A container for raw bytes.  It is inexpensive to copy a WebThreadSafeData object.
+// It is safe to pass a WebThreadSafeData across threads!!!
+class WebThreadSafeData {
+public:
+    WebThreadSafeData() { }
+    ~WebThreadSafeData() { reset(); }
+
+    WEBKIT_API void assign(const WebThreadSafeData&);
+    WEBKIT_API void reset();
+
+    WEBKIT_API size_t size() const;
+    WEBKIT_API const char* data() const;
+
+    bool isEmpty() const { return !size(); }
+
+#if WEBKIT_IMPLEMENTATION
+    WebThreadSafeData(const WTF::PassRefPtr<WebCore::RawData>&);
+    WebThreadSafeData& operator=(const WTF::PassRefPtr<WebCore::RawData>&);
+#else
+    operator std::string() const
+    {
+        size_t len = size();
+        return len ? std::string(data(), len) : std::string();
+    }
+#endif
+
+private:
+    WebPrivatePtr<WebCore::RawData> m_private;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/WebBlobData.cpp b/WebKit/chromium/src/WebBlobData.cpp
index 4cd1d67..42018dd 100644
--- a/WebKit/chromium/src/WebBlobData.cpp
+++ b/WebKit/chromium/src/WebBlobData.cpp
@@ -32,6 +32,7 @@
 #include "WebBlobData.h"
 
 #include "BlobData.h"
+#include <wtf/PassOwnPtr.h>
 
 using namespace WebCore;
 
@@ -89,54 +90,18 @@ bool WebBlobData::itemAt(size_t index, Item& result) const
     return false;
 }
 
-void WebBlobData::appendData(const WebCString& data)
-{
-    ASSERT(!isNull());
-    m_private->appendData(data);
-}
-
-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 WebURL& blobURL, long long offset, long long length)
-{
-    ASSERT(!isNull());
-    m_private->appendBlob(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)
 {
diff --git a/WebKit/chromium/src/WebBlobStorageData.cpp b/WebKit/chromium/src/WebBlobStorageData.cpp
deleted file mode 100644
index 38a25fe..0000000
--- a/WebKit/chromium/src/WebBlobStorageData.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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;
-    if (item.type == BlobDataItem::Data) {
-        result.type = WebBlobData::Item::TypeData;
-        result.data.assign(item.data.data(), static_cast<size_t>(item.data.length()));
-        return true;
-    } else {
-        ASSERT(item.type == BlobDataItem::File);
-        result.type = WebBlobData::Item::TypeFile;
-        result.filePath = item.path;
-        return true;
-    }
-}
-
-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
diff --git a/WebKit/chromium/src/WebThreadSafeData.cpp b/WebKit/chromium/src/WebThreadSafeData.cpp
new file mode 100755
index 0000000..facaba3
--- /dev/null
+++ b/WebKit/chromium/src/WebThreadSafeData.cpp
@@ -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.
+ */
+
+#include "config.h"
+#include "WebThreadSafeData.h"
+
+#include "BlobData.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebThreadSafeData::reset()
+{
+    m_private.reset();
+}
+
+void WebThreadSafeData::assign(const WebThreadSafeData& other)
+{
+    m_private = other.m_private;
+}
+
+size_t WebThreadSafeData::size() const
+{
+    if (m_private.isNull())
+        return 0;
+    return m_private->length();
+}
+
+const char* WebThreadSafeData::data() const
+{
+    if (m_private.isNull())
+        return 0;
+    return m_private->data();
+}
+
+WebThreadSafeData::WebThreadSafeData(const PassRefPtr<RawData>& data)
+    : m_private(data.releaseRef())
+{
+}
+
+WebThreadSafeData& WebThreadSafeData::operator=(const PassRefPtr<RawData>& data)
+{
+    m_private = data;
+    return *this;
+}
+
+} // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list