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

paroga at webkit.org paroga at webkit.org
Wed Dec 22 15:04:25 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9ae36e7199ac846b870c06a8eb018cf01eb1ca64
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 27 21:05:31 2010 +0000

    2010-10-27  Patrick Gansterer  <paroga at webkit.org>
    
            Reviewed by Adam Barth.
    
            Use WTF::StringHasher::createBlobHash where possible
            https://bugs.webkit.org/show_bug.cgi?id=48228
    
            Replace StringImpl::computeHash with StringHasher::createBlobHash.
            This removes many duplicated code.
    
            * bindings/js/JSSVGPODTypeWrapper.h:
            (WebCore::PODTypeWrapperCacheInfoHash::hash):
            * page/SecurityOriginHash.h:
            (WebCore::SecurityOriginHash::hash):
            * platform/cf/SchedulePair.h:
            (WebCore::SchedulePairHash::hash):
            * platform/graphics/FontCache.cpp:
            (WebCore::computeHash):
            * platform/graphics/chromium/FontPlatformDataChromiumWin.h:
            (WebCore::FontPlatformData::RefCountedHFONT::hash):
            * platform/graphics/cocoa/FontPlatformData.h:
            (WebCore::FontPlatformData::hash):
            * platform/graphics/gtk/FontPlatformDataPango.h:
            (WebCore::FontPlatformData::hash):
            * platform/graphics/wince/FontPlatformData.cpp:
            (WebCore::FixedSizeFontDataKeyHash::hash):
            * platform/graphics/wx/FontPlatformDataWx.cpp:
            (WebCore::FontPlatformData::FontPlatformData):
            (WebCore::FontPlatformData::computeHash):
            * plugins/PluginPackage.cpp:
            (WebCore::PluginPackage::hash):
            * plugins/win/PluginPackageWin.cpp:
            (WebCore::PluginPackage::hash):
            * svg/DeprecatedSVGAnimatedTemplate.h:
            (WebCore::DeprecatedSVGAnimatedTypeWrapperKeyHash::hash):
            * svg/properties/SVGAnimatedPropertyDescription.h:
            (WebCore::SVGAnimatedPropertyDescriptionHash::hash):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70705 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 66c71d2..11f1262 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-10-27  Patrick Gansterer  <paroga at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        Use WTF::StringHasher::createBlobHash where possible
+        https://bugs.webkit.org/show_bug.cgi?id=48228
+
+        Replace StringImpl::computeHash with StringHasher::createBlobHash.
+        This removes many duplicated code.
+
+        * bindings/js/JSSVGPODTypeWrapper.h:
+        (WebCore::PODTypeWrapperCacheInfoHash::hash):
+        * page/SecurityOriginHash.h:
+        (WebCore::SecurityOriginHash::hash):
+        * platform/cf/SchedulePair.h:
+        (WebCore::SchedulePairHash::hash):
+        * platform/graphics/FontCache.cpp:
+        (WebCore::computeHash):
+        * platform/graphics/chromium/FontPlatformDataChromiumWin.h:
+        (WebCore::FontPlatformData::RefCountedHFONT::hash):
+        * platform/graphics/cocoa/FontPlatformData.h:
+        (WebCore::FontPlatformData::hash):
+        * platform/graphics/gtk/FontPlatformDataPango.h:
+        (WebCore::FontPlatformData::hash):
+        * platform/graphics/wince/FontPlatformData.cpp:
+        (WebCore::FixedSizeFontDataKeyHash::hash):
+        * platform/graphics/wx/FontPlatformDataWx.cpp:
+        (WebCore::FontPlatformData::FontPlatformData):
+        (WebCore::FontPlatformData::computeHash):
+        * plugins/PluginPackage.cpp:
+        (WebCore::PluginPackage::hash):
+        * plugins/win/PluginPackageWin.cpp:
+        (WebCore::PluginPackage::hash):
+        * svg/DeprecatedSVGAnimatedTemplate.h:
+        (WebCore::DeprecatedSVGAnimatedTypeWrapperKeyHash::hash):
+        * svg/properties/SVGAnimatedPropertyDescription.h:
+        (WebCore::SVGAnimatedPropertyDescriptionHash::hash):
+
 2010-10-27  Tony Chang  <tony at chromium.org>
 
         Unreviewed, build fix after r70692.
diff --git a/WebCore/bindings/js/JSSVGPODTypeWrapper.h b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
index 2efc60e..2329365 100644
--- a/WebCore/bindings/js/JSSVGPODTypeWrapper.h
+++ b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
@@ -323,7 +323,7 @@ struct PODTypeWrapperCacheInfoHash {
 
     static unsigned hash(const CacheInfo& info)
     {
-        return StringImpl::computeHash(reinterpret_cast<const UChar*>(&info), sizeof(CacheInfo) / sizeof(UChar));
+        return WTF::StringHasher::createBlobHash<sizeof(CacheInfo)>(&info);
     }
 
     static bool equal(const CacheInfo& a, const CacheInfo& b)
diff --git a/WebCore/page/SecurityOriginHash.h b/WebCore/page/SecurityOriginHash.h
index 1915fc7..c2ebdd1 100644
--- a/WebCore/page/SecurityOriginHash.h
+++ b/WebCore/page/SecurityOriginHash.h
@@ -43,7 +43,7 @@ struct SecurityOriginHash {
             origin->host().impl() ? origin->host().impl()->hash() : 0,
             origin->port()
         };
-        return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+        return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
     }
     static unsigned hash(const RefPtr<SecurityOrigin>& origin)
     {
diff --git a/WebCore/platform/cf/SchedulePair.h b/WebCore/platform/cf/SchedulePair.h
index ed58406..8361856 100644
--- a/WebCore/platform/cf/SchedulePair.h
+++ b/WebCore/platform/cf/SchedulePair.h
@@ -73,7 +73,7 @@ struct SchedulePairHash {
     static unsigned hash(const RefPtr<SchedulePair>& pair)
     {
         uintptr_t hashCodes[2] = { reinterpret_cast<uintptr_t>(pair->runLoop()), pair->mode() ? CFHash(pair->mode()) : 0 };
-        return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+        return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
     }
 
     static bool equal(const RefPtr<SchedulePair>& a, const RefPtr<SchedulePair>& b) { return a == b; }
diff --git a/WebCore/platform/graphics/FontCache.cpp b/WebCore/platform/graphics/FontCache.cpp
index e772ba1..149ea79 100644
--- a/WebCore/platform/graphics/FontCache.cpp
+++ b/WebCore/platform/graphics/FontCache.cpp
@@ -96,7 +96,7 @@ inline unsigned computeHash(const FontPlatformDataCacheKey& fontKey)
         fontKey.m_weight,
         static_cast<unsigned>(fontKey.m_orientation) << 3 | static_cast<unsigned>(fontKey.m_italic) << 2 | static_cast<unsigned>(fontKey.m_printerFont) << 1 | static_cast<unsigned>(fontKey.m_renderingMode)
     };
-    return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+    return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
 }
 
 struct FontPlatformDataCacheKeyHash {
diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h
index beac0bf..c59cb56 100644
--- a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h
+++ b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h
@@ -102,7 +102,7 @@ private:
         HFONT hfont() const { return m_hfont; }
         unsigned hash() const
         {
-            return StringImpl::computeHash(reinterpret_cast<const UChar*>(&m_hfont), sizeof(HFONT) / sizeof(UChar));
+            return WTF::StringHasher::createBlobHash<sizeof(HFONT)>(&m_hfont);
         }
 
         bool operator==(const RefCountedHFONT& other) const
diff --git a/WebCore/platform/graphics/cocoa/FontPlatformData.h b/WebCore/platform/graphics/cocoa/FontPlatformData.h
index 9cee714..17ae4b5 100644
--- a/WebCore/platform/graphics/cocoa/FontPlatformData.h
+++ b/WebCore/platform/graphics/cocoa/FontPlatformData.h
@@ -110,7 +110,7 @@ class FontPlatformData {
     {
         ASSERT(m_font != 0 || m_cgFont == 0);
         uintptr_t hashCodes[2] = { (uintptr_t)m_font, m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique };
-        return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+        return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
     }
 
     const FontPlatformData& operator=(const FontPlatformData& f);
diff --git a/WebCore/platform/graphics/gtk/FontPlatformDataPango.h b/WebCore/platform/graphics/gtk/FontPlatformDataPango.h
index 7b1e51f..c42af7f 100644
--- a/WebCore/platform/graphics/gtk/FontPlatformDataPango.h
+++ b/WebCore/platform/graphics/gtk/FontPlatformDataPango.h
@@ -71,7 +71,7 @@ public:
     unsigned hash() const
     {
         uintptr_t hashCodes[1] = { reinterpret_cast<uintptr_t>(m_scaledFont) };
-        return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+        return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
     }
 
     bool operator==(const FontPlatformData&) const;
diff --git a/WebCore/platform/graphics/wince/FontPlatformData.cpp b/WebCore/platform/graphics/wince/FontPlatformData.cpp
index d84a7cc..d9d8a72 100644
--- a/WebCore/platform/graphics/wince/FontPlatformData.cpp
+++ b/WebCore/platform/graphics/wince/FontPlatformData.cpp
@@ -148,7 +148,7 @@ struct FixedSizeFontDataKeyHash {
             font.m_weight,
             // static_cast<unsigned>(font.m_italic);
         };
-        return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+        return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
     }
 
     static bool equal(const FixedSizeFontDataKey& a, const FixedSizeFontDataKey& b)
diff --git a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
index b77a03b..66c69ee 100644
--- a/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
+++ b/WebCore/platform/graphics/wx/FontPlatformDataWx.cpp
@@ -111,20 +111,25 @@ FontPlatformData::FontPlatformData(const FontDescription& desc, const AtomicStri
     m_size = desc.computedPixelSize();
     m_fontState = VALID;
     m_size = desc.computedPixelSize();
-     
 }
 
-unsigned FontPlatformData::computeHash() const {
-        wxFont* thisFont = m_font->font();
-        ASSERT(thisFont && thisFont->IsOk());
-        
-        // make a hash that is unique for this font, but not globally unique - that is,
-        // a font whose properties are equal should generate the same hash
-        uintptr_t hashCodes[6] = { thisFont->GetPointSize(), thisFont->GetFamily(), thisFont->GetStyle(), 
-                                    thisFont->GetWeight(), thisFont->GetUnderlined(), 
-                                    StringImpl::computeHash(thisFont->GetFaceName().utf8_str()) };
-        
-        return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+unsigned FontPlatformData::computeHash() const
+{
+    wxFont* thisFont = m_font->font();
+    ASSERT(thisFont && thisFont->IsOk());
+
+    // make a hash that is unique for this font, but not globally unique - that is,
+    // a font whose properties are equal should generate the same hash
+    uintptr_t hashCodes[6] = {
+        thisFont->GetPointSize(),
+        thisFont->GetFamily(),
+        thisFont->GetStyle(),
+        thisFont->GetWeight(),
+        thisFont->GetUnderlined(), 
+        StringImpl::computeHash(thisFont->GetFaceName().utf8_str())
+    };
+
+    return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
 }
 
 FontPlatformData::~FontPlatformData()
diff --git a/WebCore/plugins/PluginPackage.cpp b/WebCore/plugins/PluginPackage.cpp
index 2e0308b..10149bf 100644
--- a/WebCore/plugins/PluginPackage.cpp
+++ b/WebCore/plugins/PluginPackage.cpp
@@ -348,7 +348,7 @@ unsigned PluginPackage::hash() const
         m_lastModified
     };
 
-    return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+    return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
 }
 
 bool PluginPackage::equal(const PluginPackage& a, const PluginPackage& b)
diff --git a/WebCore/plugins/win/PluginPackageWin.cpp b/WebCore/plugins/win/PluginPackageWin.cpp
index f3dd781..74bd2a9 100644
--- a/WebCore/plugins/win/PluginPackageWin.cpp
+++ b/WebCore/plugins/win/PluginPackageWin.cpp
@@ -312,7 +312,7 @@ unsigned PluginPackage::hash() const
         m_mimeToExtensions.size()
     };
 
-    return StringImpl::computeHash(reinterpret_cast<const UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar));
+    return WTF::StringHasher::createBlobHash<sizeof(hashCodes)>(hashCodes);
 }
 
 bool PluginPackage::equal(const PluginPackage& a, const PluginPackage& b)
diff --git a/WebCore/svg/DeprecatedSVGAnimatedTemplate.h b/WebCore/svg/DeprecatedSVGAnimatedTemplate.h
index de24fe4..99abca7 100644
--- a/WebCore/svg/DeprecatedSVGAnimatedTemplate.h
+++ b/WebCore/svg/DeprecatedSVGAnimatedTemplate.h
@@ -72,7 +72,7 @@ namespace WebCore {
     struct DeprecatedSVGAnimatedTypeWrapperKeyHash {
         static unsigned hash(const DeprecatedSVGAnimatedTypeWrapperKey& key)
         {
-            return StringImpl::computeHash(reinterpret_cast<const UChar*>(&key), sizeof(DeprecatedSVGAnimatedTypeWrapperKey) / sizeof(UChar));
+            return WTF::StringHasher::createBlobHash<sizeof(DeprecatedSVGAnimatedTypeWrapperKey)>(&key);
         }
 
         static bool equal(const DeprecatedSVGAnimatedTypeWrapperKey& a, const DeprecatedSVGAnimatedTypeWrapperKey& b)
diff --git a/WebCore/svg/properties/SVGAnimatedPropertyDescription.h b/WebCore/svg/properties/SVGAnimatedPropertyDescription.h
index 9895054..6fb5e66 100644
--- a/WebCore/svg/properties/SVGAnimatedPropertyDescription.h
+++ b/WebCore/svg/properties/SVGAnimatedPropertyDescription.h
@@ -69,7 +69,7 @@ struct SVGAnimatedPropertyDescription {
 struct SVGAnimatedPropertyDescriptionHash {
     static unsigned hash(const SVGAnimatedPropertyDescription& key)
     {
-        return StringImpl::computeHash(reinterpret_cast<const UChar*>(&key), sizeof(SVGAnimatedPropertyDescription) / sizeof(UChar));
+        return WTF::StringHasher::createBlobHash<sizeof(SVGAnimatedPropertyDescription)>(&key);
     }
 
     static bool equal(const SVGAnimatedPropertyDescription& a, const SVGAnimatedPropertyDescription& b)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list