Title: [135211] branches/chromium/1312/Source/WebCore/platform/graphics

Diff

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/FontCache.cpp (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/FontCache.cpp	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/FontCache.cpp	2012-11-20 00:34:12 UTC (rev 135211)
@@ -228,7 +228,7 @@
 }
 
 #if ENABLE(OPENTYPE_VERTICAL)
-typedef HashMap<FontCache::FontFileKey, OwnPtr<OpenTypeVerticalData>, WTF::IntHash<FontCache::FontFileKey>, WTF::UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey> > FontVerticalDataCache;
+typedef HashMap<FontCache::FontFileKey, RefPtr<OpenTypeVerticalData>, WTF::IntHash<FontCache::FontFileKey>, WTF::UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey> > FontVerticalDataCache;
 
 FontVerticalDataCache& fontVerticalDataCacheInstance()
 {
@@ -236,19 +236,17 @@
     return fontVerticalDataCache;
 }
 
-OpenTypeVerticalData* FontCache::getVerticalData(const FontFileKey& key, const FontPlatformData& platformData)
+PassRefPtr<OpenTypeVerticalData> FontCache::getVerticalData(const FontFileKey& key, const FontPlatformData& platformData)
 {
     FontVerticalDataCache& fontVerticalDataCache = fontVerticalDataCacheInstance();
     FontVerticalDataCache::iterator result = fontVerticalDataCache.find(key);
     if (result != fontVerticalDataCache.end())
-        return result.get()->value.get();
+        return result.get()->value;
 
-    OpenTypeVerticalData* verticalData = new OpenTypeVerticalData(platformData);
-    if (!verticalData->isOpenType()) {
-        delete verticalData;
-        verticalData = 0; // Put 0 in cache to mark that this isn't an OpenType font.
-    }
-    fontVerticalDataCache.set(key, adoptPtr(verticalData));
+    RefPtr<OpenTypeVerticalData> verticalData = OpenTypeVerticalData::create(platformData);
+    if (!verticalData->isOpenType())
+        verticalData.clear();
+    fontVerticalDataCache.set(key, verticalData);
     return verticalData;
 }
 #endif

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/FontCache.h (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/FontCache.h	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/FontCache.h	2012-11-20 00:34:12 UTC (rev 135211)
@@ -113,7 +113,7 @@
 #else
     typedef AtomicString FontFileKey;
 #endif
-    OpenTypeVerticalData* getVerticalData(const FontFileKey&, const FontPlatformData&);
+    PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const FontPlatformData&);
 #endif
 
     struct SimpleFontFamily {

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/SimpleFontData.cpp (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/SimpleFontData.cpp	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/SimpleFontData.cpp	2012-11-20 00:34:12 UTC (rev 135211)
@@ -61,7 +61,7 @@
 #if ENABLE(OPENTYPE_VERTICAL)
     if (platformData.orientation() == Vertical && !isTextOrientationFallback) {
         m_verticalData = platformData.verticalData();
-        m_hasVerticalGlyphs = m_verticalData && m_verticalData->hasVerticalMetrics();
+        m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVerticalMetrics();
     }
 #endif
 }

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/SimpleFontData.h (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/SimpleFontData.h	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/SimpleFontData.h	2012-11-20 00:34:12 UTC (rev 135211)
@@ -102,7 +102,7 @@
 
     const FontPlatformData& platformData() const { return m_platformData; }
 #if ENABLE(OPENTYPE_VERTICAL)
-    const OpenTypeVerticalData* verticalData() const { return m_verticalData; }
+    const OpenTypeVerticalData* verticalData() const { return m_verticalData.get(); }
 #endif
 
     PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const;
@@ -273,7 +273,7 @@
     bool m_isTextOrientationFallback;
     bool m_isBrokenIdeographFallback;
 #if ENABLE(OPENTYPE_VERTICAL)
-    const OpenTypeVerticalData* m_verticalData;
+    RefPtr<OpenTypeVerticalData> m_verticalData;
 #endif
     bool m_hasVerticalGlyphs;
     

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp	2012-11-20 00:34:12 UTC (rev 135211)
@@ -192,7 +192,7 @@
 }
 
 #if ENABLE(OPENTYPE_VERTICAL)
-const OpenTypeVerticalData* FontPlatformData::verticalData() const
+PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const
 {
     SkFontID id = typeface()->uniqueID();
     return fontCache()->getVerticalData(id, *this);

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h	2012-11-20 00:34:12 UTC (rev 135211)
@@ -97,7 +97,7 @@
     }
 
 #if ENABLE(OPENTYPE_VERTICAL)
-    const OpenTypeVerticalData* verticalData() const;
+    PassRefPtr<OpenTypeVerticalData> verticalData() const;
     PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
 #endif
 

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp	2012-11-20 00:34:12 UTC (rev 135211)
@@ -348,7 +348,7 @@
     return (tableTag >> 24) | ((tableTag >> 8) & 0xff00) | ((tableTag & 0xff00) << 8) | ((tableTag & 0xff) << 24);
 }
 
-const OpenTypeVerticalData* FontPlatformData::verticalData() const
+PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const
 {
     return fontCache()->getVerticalData(uniqueID(), *this);
 }

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h	2012-11-20 00:34:12 UTC (rev 135211)
@@ -33,6 +33,7 @@
 
 #include "FontOrientation.h"
 #include "FontRenderStyle.h"
+#include "OpenTypeVerticalData.h"
 #include "SharedBuffer.h"
 #include "SkPaint.h"
 #include "TextOrientation.h"
@@ -47,7 +48,6 @@
 namespace WebCore {
 
 class FontDescription;
-class OpenTypeVerticalData;
 
 #if USE(HARFBUZZ_NG)
 class HarfBuzzNGFace;
@@ -105,7 +105,7 @@
     bool isHashTableDeletedValue() const { return m_typeface == hashTableDeletedFontValue(); }
 
 #if ENABLE(OPENTYPE_VERTICAL)
-    const OpenTypeVerticalData* verticalData() const;
+    PassRefPtr<OpenTypeVerticalData> verticalData() const;
     PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
 #endif
 

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.h (135210 => 135211)


--- branches/chromium/1312/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.h	2012-11-20 00:32:12 UTC (rev 135210)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.h	2012-11-20 00:34:12 UTC (rev 135211)
@@ -29,6 +29,8 @@
 
 #include "Glyph.h"
 #include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -37,9 +39,12 @@
 class GlyphPage;
 class SimpleFontData;
 
-class OpenTypeVerticalData {
+class OpenTypeVerticalData : public RefCounted<OpenTypeVerticalData> {
 public:
-    OpenTypeVerticalData(const FontPlatformData&);
+    static PassRefPtr<OpenTypeVerticalData> create(const FontPlatformData& platformData)
+    {
+        return adoptRef(new OpenTypeVerticalData(platformData));
+    }
 
     bool isOpenType() const { return !m_advanceWidths.isEmpty(); }
     bool hasVerticalMetrics() const { return !m_advanceHeights.isEmpty(); }
@@ -48,6 +53,8 @@
     void substituteWithVerticalGlyphs(const SimpleFontData*, GlyphPage*, unsigned offset, unsigned length) const;
 
 private:
+    explicit OpenTypeVerticalData(const FontPlatformData&);
+
     void loadMetrics(const FontPlatformData&);
     void loadVerticalGlyphSubstitutions(const FontPlatformData&);
     bool hasVORG() const { return !m_vertOriginY.isEmpty(); }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to