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

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 15:23:47 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3b9f37a54b24487b6bdd5700b534805cf5370829
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 2 19:20:37 2010 +0000

    2010-11-02  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            Remove special handling of HashTableDeletedValue in PlatformRefPtr and manually manage memory that cannot be controlled by HashTraits
            https://bugs.webkit.org/show_bug.cgi?id=48841
    
            Remove special handling of HashTableDeletedValue in PlatformRefPtr.
            This is better handled on a case-by-case basis, when HashTraits
            cannot account for it.
    
            * wtf/PlatformRefPtr.h:
            (WTF::PlatformRefPtr::~PlatformRefPtr):
            (WTF::PlatformRefPtr::clear):
            (WTF::::operator):
    2010-11-02  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            Remove special handling of HashTableDeletedValue in PlatformRefPtr and manually manage memory that cannot be controlled by HashTraits
            https://bugs.webkit.org/show_bug.cgi?id=48841
    
            Switch to manually managing the memory in FontPlatformDataFreeType. This
            is necessary because smart pointers do not know how to deal with a pointer
            value of -1 (HashTableDeletedValue) and HashTraits can only manage the type
            contained in the HashMap.
    
            No new tests as this should not change functionality.
    
            * platform/graphics/cairo/FontPlatformDataFreeType.cpp:
            (WebCore::FontPlatformData::FontPlatformData):
            (WebCore::FontPlatformData::operator=):
            (WebCore::FontPlatformData::~FontPlatformData):
            (WebCore::FontPlatformData::operator==):
            (WebCore::FontPlatformData::initializeWithFontFace):
            * platform/graphics/cairo/FontPlatformDataFreeType.h:
            (WebCore::FontPlatformData::FontPlatformData):
            (WebCore::FontPlatformData::scaledFont):
            (WebCore::FontPlatformData::hash):
            (WebCore::FontPlatformData::isHashTableDeletedValue):
            (WebCore::FontPlatformData::hashTableDeletedFontValue):
            * platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp:
            (WebCore::GlyphPage::fill):
            * platform/graphics/cairo/SimpleFontDataCairo.cpp:
            (WebCore::SimpleFontData::platformInit):
            (WebCore::SimpleFontData::containsCharacters):
            (WebCore::SimpleFontData::platformWidthForGlyph):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71148 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 7b935d4..a7f897d 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-02  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        Remove special handling of HashTableDeletedValue in PlatformRefPtr and manually manage memory that cannot be controlled by HashTraits
+        https://bugs.webkit.org/show_bug.cgi?id=48841
+
+        Remove special handling of HashTableDeletedValue in PlatformRefPtr.
+        This is better handled on a case-by-case basis, when HashTraits
+        cannot account for it.
+
+        * wtf/PlatformRefPtr.h:
+        (WTF::PlatformRefPtr::~PlatformRefPtr):
+        (WTF::PlatformRefPtr::clear):
+        (WTF::::operator):
+
 2010-10-29  Oliver Hunt  <oliver at apple.com>
 
         Reviewed by Gavin Barraclough.
diff --git a/JavaScriptCore/wtf/PlatformRefPtr.h b/JavaScriptCore/wtf/PlatformRefPtr.h
index f99ec9b..8ac16cb 100644
--- a/JavaScriptCore/wtf/PlatformRefPtr.h
+++ b/JavaScriptCore/wtf/PlatformRefPtr.h
@@ -62,8 +62,7 @@ public:
 
     ~PlatformRefPtr()
     {
-        T* ptr = m_ptr;
-        if (ptr && ptr != hashTableDeletedValue())
+        if (T* ptr = m_ptr)
             derefPlatformPtr(ptr);
     }
 
@@ -71,7 +70,7 @@ public:
     {
         T* ptr = m_ptr;
         m_ptr = 0;
-        if (ptr && ptr != hashTableDeletedValue())
+        if (ptr)
             derefPlatformPtr(ptr);
     }
 
@@ -111,7 +110,7 @@ template <typename T> inline PlatformRefPtr<T>& PlatformRefPtr<T>::operator=(con
         refPlatformPtr(optr);
     T* ptr = m_ptr;
     m_ptr = optr;
-    if (ptr && ptr != hashTableDeletedValue())
+    if (ptr)
         derefPlatformPtr(ptr);
     return *this;
 }
@@ -122,7 +121,7 @@ template <typename T> inline PlatformRefPtr<T>& PlatformRefPtr<T>::operator=(T*
     if (optr)
         refPlatformPtr(optr);
     m_ptr = optr;
-    if (ptr && ptr != hashTableDeletedValue())
+    if (ptr)
         derefPlatformPtr(ptr);
     return *this;
 }
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 402130a..a300d0f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+2010-11-02  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        Remove special handling of HashTableDeletedValue in PlatformRefPtr and manually manage memory that cannot be controlled by HashTraits
+        https://bugs.webkit.org/show_bug.cgi?id=48841
+
+        Switch to manually managing the memory in FontPlatformDataFreeType. This
+        is necessary because smart pointers do not know how to deal with a pointer
+        value of -1 (HashTableDeletedValue) and HashTraits can only manage the type
+        contained in the HashMap. 
+
+        No new tests as this should not change functionality.
+
+        * platform/graphics/cairo/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::FontPlatformData):
+        (WebCore::FontPlatformData::operator=):
+        (WebCore::FontPlatformData::~FontPlatformData):
+        (WebCore::FontPlatformData::operator==):
+        (WebCore::FontPlatformData::initializeWithFontFace):
+        * platform/graphics/cairo/FontPlatformDataFreeType.h:
+        (WebCore::FontPlatformData::FontPlatformData):
+        (WebCore::FontPlatformData::scaledFont):
+        (WebCore::FontPlatformData::hash):
+        (WebCore::FontPlatformData::isHashTableDeletedValue):
+        (WebCore::FontPlatformData::hashTableDeletedFontValue):
+        * platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp:
+        (WebCore::GlyphPage::fill):
+        * platform/graphics/cairo/SimpleFontDataCairo.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        (WebCore::SimpleFontData::containsCharacters):
+        (WebCore::SimpleFontData::platformWidthForGlyph):
+
 2010-11-02  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
index ba307fa..ebbc50d 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.cpp
@@ -120,6 +120,7 @@ FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fo
     , m_syntheticBold(false)
     , m_syntheticOblique(false)
     , m_fixedWidth(false)
+    , m_scaledFont(0)
 {
     PlatformRefPtr<cairo_font_face_t> fontFace = adoptPlatformRef(cairo_ft_font_face_create_for_pattern(m_pattern.get()));
     initializeWithFontFace(fontFace.get());
@@ -142,6 +143,7 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool italic)
     , m_syntheticBold(bold)
     , m_syntheticOblique(italic)
     , m_fixedWidth(false)
+    , m_scaledFont(0)
 {
     // We cannot create a scaled font here.
 }
@@ -151,13 +153,14 @@ FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool
     , m_size(size)
     , m_syntheticBold(bold)
     , m_syntheticOblique(italic)
+    , m_scaledFont(0)
 {
     initializeWithFontFace(fontFace);
 
-    FT_Face fontConfigFace = cairo_ft_scaled_font_lock_face(m_scaledFont.get());
+    FT_Face fontConfigFace = cairo_ft_scaled_font_lock_face(m_scaledFont);
     if (fontConfigFace) {
         m_fixedWidth = fontConfigFace->face_flags & FT_FACE_FLAG_FIXED_WIDTH;
-        cairo_ft_scaled_font_unlock_face(m_scaledFont.get());
+        cairo_ft_scaled_font_unlock_face(m_scaledFont);
     }
 }
 
@@ -171,7 +174,6 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
     m_syntheticBold = other.m_syntheticBold;
     m_syntheticOblique = other.m_syntheticOblique;
     m_fixedWidth = other.m_fixedWidth;
-    m_scaledFont = other.m_scaledFont;
     m_pattern = other.m_pattern;
 
     if (m_fallbacks) {
@@ -180,11 +182,16 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
         m_fallbacks = 0;
     }
 
+    if (m_scaledFont && m_scaledFont != hashTableDeletedFontValue())
+        cairo_scaled_font_destroy(m_scaledFont);
+    m_scaledFont = cairo_scaled_font_reference(other.m_scaledFont);
+
     return *this;
 }
 
 FontPlatformData::FontPlatformData(const FontPlatformData& other)
     : m_fallbacks(0)
+    , m_scaledFont(0)
 {
     *this = other;
 }
@@ -196,7 +203,7 @@ FontPlatformData::FontPlatformData(const FontPlatformData& other, float size)
     // We need to reinitialize the instance, because the difference in size 
     // necessitates a new scaled font instance.
     m_size = size;
-    initializeWithFontFace(cairo_scaled_font_get_font_face(m_scaledFont.get()));
+    initializeWithFontFace(cairo_scaled_font_get_font_face(m_scaledFont));
 }
 
 FontPlatformData::~FontPlatformData()
@@ -205,6 +212,9 @@ FontPlatformData::~FontPlatformData()
         FcFontSetDestroy(m_fallbacks);
         m_fallbacks = 0;
     }
+
+    if (m_scaledFont && m_scaledFont != hashTableDeletedFontValue())
+        cairo_scaled_font_destroy(m_scaledFont);
 }
 
 bool FontPlatformData::isFixedPitch()
@@ -216,7 +226,7 @@ bool FontPlatformData::operator==(const FontPlatformData& other) const
 {
     if (m_pattern == other.m_pattern)
         return true;
-    if (!m_pattern || m_pattern.isHashTableDeletedValue() || !other.m_pattern || other.m_pattern.isHashTableDeletedValue())
+    if (!m_pattern || !other.m_pattern)
         return false;
     return FcPatternEqual(m_pattern.get(), other.m_pattern.get());
 }
@@ -256,7 +266,7 @@ void FontPlatformData::initializeWithFontFace(cairo_font_face_t* fontFace)
         cairo_matrix_scale(&fontMatrix, m_size, m_size);
     }
 
-    m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options));
+    m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
     cairo_font_options_destroy(options);
 }
 
diff --git a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
index d47d556..8c0bde8 100644
--- a/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
+++ b/WebCore/platform/graphics/cairo/FontPlatformDataFreeType.h
@@ -43,7 +43,7 @@ public:
         , m_size(0)
         , m_syntheticBold(false)
         , m_syntheticOblique(false)
-        , m_scaledFont(WTF::HashTableDeletedValue)
+        , m_scaledFont(hashTableDeletedFontValue())
         { }
 
     FontPlatformData()
@@ -51,6 +51,7 @@ public:
         , m_size(0)
         , m_syntheticBold(false)
         , m_syntheticOblique(false)
+        , m_scaledFont(0)
         { }
 
     FontPlatformData(FcPattern*, const FontDescription&);
@@ -67,18 +68,18 @@ public:
     bool syntheticBold() const { return m_syntheticBold; }
     bool syntheticOblique() const { return m_syntheticOblique; }
 
-    cairo_scaled_font_t* scaledFont() const { return m_scaledFont.get(); }
+    cairo_scaled_font_t* scaledFont() const { return m_scaledFont; }
 
     unsigned hash() const
     {
-        return PtrHash<cairo_scaled_font_t*>::hash(m_scaledFont.get());
+        return PtrHash<cairo_scaled_font_t*>::hash(m_scaledFont);
     }
 
     bool operator==(const FontPlatformData&) const;
     FontPlatformData& operator=(const FontPlatformData&);
     bool isHashTableDeletedValue() const
     {
-        return m_scaledFont.isHashTableDeletedValue();
+        return m_scaledFont == hashTableDeletedFontValue();
     }
 
 #ifndef NDEBUG
@@ -91,10 +92,11 @@ public:
     bool m_syntheticBold;
     bool m_syntheticOblique;
     bool m_fixedWidth;
-    PlatformRefPtr<cairo_scaled_font_t> m_scaledFont;
+    cairo_scaled_font_t* m_scaledFont;
 
 private:
     void initializeWithFontFace(cairo_font_face_t*);
+    static cairo_scaled_font_t* hashTableDeletedFontValue() { return reinterpret_cast<cairo_scaled_font_t*>(-1); }
 };
 
 }
diff --git a/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp b/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp
index 66e9c16..e2f09f4 100644
--- a/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp
@@ -45,7 +45,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
     if (bufferLength > GlyphPage::size)
         return false;
 
-    FT_Face face = cairo_ft_scaled_font_lock_face(fontData->platformData().m_scaledFont.get());
+    FT_Face face = cairo_ft_scaled_font_lock_face(fontData->platformData().scaledFont());
     if (!face)
         return false;
 
@@ -60,7 +60,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
         }
     }
 
-    cairo_ft_scaled_font_unlock_face(fontData->platformData().m_scaledFont.get());
+    cairo_ft_scaled_font_unlock_face(fontData->platformData().scaledFont());
 
     return haveGlyphs;
 }
diff --git a/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp b/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp
index 3d7c34b..d350294 100644
--- a/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp
+++ b/WebCore/platform/graphics/cairo/SimpleFontDataCairo.cpp
@@ -49,7 +49,7 @@ void SimpleFontData::platformInit()
 {
     cairo_font_extents_t font_extents;
     cairo_text_extents_t text_extents;
-    cairo_scaled_font_extents(m_platformData.m_scaledFont.get(), &font_extents);
+    cairo_scaled_font_extents(m_platformData.scaledFont(), &font_extents);
     m_ascent = static_cast<int>(lroundf(font_extents.ascent));
     m_descent = static_cast<int>(lroundf(font_extents.descent));
     m_lineSpacing = static_cast<int>(lroundf(font_extents.height));
@@ -60,9 +60,9 @@ void SimpleFontData::platformInit()
     // while we figure out what's going on.
     if (m_lineSpacing < m_ascent + m_descent)
         m_lineSpacing = m_ascent + m_descent;
-    cairo_scaled_font_text_extents(m_platformData.m_scaledFont.get(), "x", &text_extents);
+    cairo_scaled_font_text_extents(m_platformData.scaledFont(), "x", &text_extents);
     m_xHeight = text_extents.height;
-    cairo_scaled_font_text_extents(m_platformData.m_scaledFont.get(), " ", &text_extents);
+    cairo_scaled_font_text_extents(m_platformData.scaledFont(), " ", &text_extents);
     m_spaceWidth = static_cast<float>(text_extents.x_advance);
     m_lineGap = m_lineSpacing - m_ascent - m_descent;
     m_syntheticBoldOffset = m_platformData.syntheticBold() ? 1.0f : 0.f;
@@ -94,19 +94,19 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes
 
 bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
 {
-    FT_Face face = cairo_ft_scaled_font_lock_face(m_platformData.m_scaledFont.get());
+    FT_Face face = cairo_ft_scaled_font_lock_face(m_platformData.scaledFont());
 
     if (!face)
         return false;
 
     for (int i = 0; i < length; i++) {
         if (FcFreeTypeCharIndex(face, characters[i]) == 0) {
-            cairo_ft_scaled_font_unlock_face(m_platformData.m_scaledFont.get());
+            cairo_ft_scaled_font_unlock_face(m_platformData.scaledFont());
             return false;
         }
     }
 
-    cairo_ft_scaled_font_unlock_face(m_platformData.m_scaledFont.get());
+    cairo_ft_scaled_font_unlock_face(m_platformData.scaledFont());
 
     return true;
 }
@@ -123,14 +123,14 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const
 
 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
 {
-    ASSERT(m_platformData.m_scaledFont);
+    ASSERT(m_platformData.scaledFont());
 
     cairo_glyph_t cglyph = { glyph, 0, 0 };
     cairo_text_extents_t extents;
-    cairo_scaled_font_glyph_extents(m_platformData.m_scaledFont.get(), &cglyph, 1, &extents);
+    cairo_scaled_font_glyph_extents(m_platformData.scaledFont(), &cglyph, 1, &extents);
 
     float w = (float)m_spaceWidth;
-    if (cairo_scaled_font_status(m_platformData.m_scaledFont.get()) == CAIRO_STATUS_SUCCESS && extents.x_advance)
+    if (cairo_scaled_font_status(m_platformData.scaledFont()) == CAIRO_STATUS_SUCCESS && extents.x_advance)
         w = (float)extents.x_advance;
 
     return w;    

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list