Title: [127932] trunk
Revision
127932
Author
[email protected]
Date
2012-09-07 15:58:56 -0700 (Fri, 07 Sep 2012)

Log Message

Unreviewed, rolling out r127920 and r127926.
http://trac.webkit.org/changeset/127920
http://trac.webkit.org/changeset/127926
https://bugs.webkit.org/show_bug.cgi?id=96152

billions and billions of assertion failures on mac debug
builds (Requested by thorton on #webkit).

Patch by Sheriff Bot <[email protected]> on 2012-09-07

Source/WebCore:

* WebCore.exp.in:
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData):
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::getFontData):
* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::registerCustomFont):
(WebCore):
(WebCore::Document::deleteCustomFonts):
(WebCore::Document::reportMemoryUsage):
* dom/Document.h:
(WebCore):
(Document):
* platform/graphics/FontData.h:
* platform/graphics/FontFallbackList.cpp:
(WebCore::FontFallbackList::releaseFontData):
(WebCore::FontFallbackList::fontDataAt):
(WebCore::FontFallbackList::setPlatformFont):
* platform/graphics/FontFallbackList.h:
(FontFallbackList):
(WebCore::FontFallbackList::setGlyphPageZero):
(WebCore::FontFallbackList::setGlyphPages):
* platform/graphics/GlyphPageTreeNode.cpp:
(WebCore::GlyphPageTreeNode::pruneFontData):

LayoutTests:

* fast/frames/seamless/seamless-custom-font-pruning-crash-expected.txt: Removed.
* fast/frames/seamless/seamless-custom-font-pruning-crash.html: Removed.
* fast/frames/seamless/seamless-nested-crash-expected.txt: Removed.
* fast/frames/seamless/seamless-nested-crash.html: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127931 => 127932)


--- trunk/LayoutTests/ChangeLog	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/LayoutTests/ChangeLog	2012-09-07 22:58:56 UTC (rev 127932)
@@ -1,3 +1,18 @@
+2012-09-07  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r127920 and r127926.
+        http://trac.webkit.org/changeset/127920
+        http://trac.webkit.org/changeset/127926
+        https://bugs.webkit.org/show_bug.cgi?id=96152
+
+        billions and billions of assertion failures on mac debug
+        builds (Requested by thorton on #webkit).
+
+        * fast/frames/seamless/seamless-custom-font-pruning-crash-expected.txt: Removed.
+        * fast/frames/seamless/seamless-custom-font-pruning-crash.html: Removed.
+        * fast/frames/seamless/seamless-nested-crash-expected.txt: Removed.
+        * fast/frames/seamless/seamless-nested-crash.html: Removed.
+
 2012-09-07  Dominic Mazzoni  <[email protected]>
 
         AX: Chromium needs access to canvasHasFallbackContent

Deleted: trunk/LayoutTests/fast/frames/seamless/seamless-custom-font-pruning-crash-expected.txt (127931 => 127932)


--- trunk/LayoutTests/fast/frames/seamless/seamless-custom-font-pruning-crash-expected.txt	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-custom-font-pruning-crash-expected.txt	2012-09-07 22:58:56 UTC (rev 127932)
@@ -1 +0,0 @@
-This test passes if it does not crash. This test passes if it does not crash.

Deleted: trunk/LayoutTests/fast/frames/seamless/seamless-custom-font-pruning-crash.html (127931 => 127932)


--- trunk/LayoutTests/fast/frames/seamless/seamless-custom-font-pruning-crash.html	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-custom-font-pruning-crash.html	2012-09-07 22:58:56 UTC (rev 127932)
@@ -1,33 +0,0 @@
-<html>
-  This test passes if it does not crash.
-  <style>@font-face {
-    font-family: "Times New Roman";
-    src: local("Arial")
-  </style>
-  <script>
-    if (window.testRunner) {
-      testRunner.dumpAsText();
-      testRunner.waitUntilDone();
-    }
-    var docElement = document.body ? document.body : document.documentElement;
-
-    function initTest() {
-      iframeElement = document.createElementNS("http://www.w3.org/1999/xhtml", "iframe");
-      iframeElement.setAttribute("seamless", "");
-      iframeElement.setAttribute("srcdoc", "This test passes if it does not crash. <iframe seamless sandbox='allow-scripts' srcdoc='This test passes if it does not crash.'");
-      docElement.appendChild(iframeElement);
-
-      textElement = document.createTextNode("This test passes if it does not crash.");
-      docElement.appendChild(textElement);
-      setTimeout("crash()", 0);
-    }
-
-    document.addEventListener("DOMContentLoaded", initTest, false);
-
-    function crash() {
-      docElement.appendChild(iframeElement);
-      if (window.testRunner)
-        testRunner.notifyDone();
-    }
-  </script>
-</html>
\ No newline at end of file

Deleted: trunk/LayoutTests/fast/frames/seamless/seamless-nested-crash-expected.txt (127931 => 127932)


--- trunk/LayoutTests/fast/frames/seamless/seamless-nested-crash-expected.txt	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-nested-crash-expected.txt	2012-09-07 22:58:56 UTC (rev 127932)
@@ -1 +0,0 @@
-This test passes if it does not crash.

Deleted: trunk/LayoutTests/fast/frames/seamless/seamless-nested-crash.html (127931 => 127932)


--- trunk/LayoutTests/fast/frames/seamless/seamless-nested-crash.html	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-nested-crash.html	2012-09-07 22:58:56 UTC (rev 127932)
@@ -1,30 +0,0 @@
-<html>
-  <head>
-    <script>
-      if (window.testRunner) {
-          testRunner.dumpAsText();
-          testRunner.waitUntilDone();
-      }
-      if (window.eventSender)
-        for (i=0; i<10; i++)
-          setTimeout('eventSender.mouseMoveTo(' + i + ', ' + i + ');', i);
-      setTimeout(function() {
-        document.body.innerHTML = "This test passes if it does not crash.";
-        if (window.testRunner)
-          testRunner.notifyDone();
-      }, 10);
-    </script>
-    <style>
-      @font-face { font-family: "A"; src: url(); }
-      * { font-family: A; }
-    </style>
-  </head>
-  <body>
-    <!-- Multiple lines of text are needed to crash -->
-    This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. This is a really long line. 
-    <iframe seamless src=""
-    <!-- This lonely <style> is needed to crash -->
-    <style>
-    </style>
-  </body>
-</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (127931 => 127932)


--- trunk/Source/WebCore/ChangeLog	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/ChangeLog	2012-09-07 22:58:56 UTC (rev 127932)
@@ -1,3 +1,39 @@
+2012-09-07  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r127920 and r127926.
+        http://trac.webkit.org/changeset/127920
+        http://trac.webkit.org/changeset/127926
+        https://bugs.webkit.org/show_bug.cgi?id=96152
+
+        billions and billions of assertion failures on mac debug
+        builds (Requested by thorton on #webkit).
+
+        * WebCore.exp.in:
+        * css/CSSFontFaceSource.cpp:
+        (WebCore::CSSFontFaceSource::getFontData):
+        * css/CSSSegmentedFontFace.cpp:
+        (WebCore::CSSSegmentedFontFace::getFontData):
+        * dom/Document.cpp:
+        (WebCore::Document::~Document):
+        (WebCore::Document::registerCustomFont):
+        (WebCore):
+        (WebCore::Document::deleteCustomFonts):
+        (WebCore::Document::reportMemoryUsage):
+        * dom/Document.h:
+        (WebCore):
+        (Document):
+        * platform/graphics/FontData.h:
+        * platform/graphics/FontFallbackList.cpp:
+        (WebCore::FontFallbackList::releaseFontData):
+        (WebCore::FontFallbackList::fontDataAt):
+        (WebCore::FontFallbackList::setPlatformFont):
+        * platform/graphics/FontFallbackList.h:
+        (FontFallbackList):
+        (WebCore::FontFallbackList::setGlyphPageZero):
+        (WebCore::FontFallbackList::setGlyphPages):
+        * platform/graphics/GlyphPageTreeNode.cpp:
+        (WebCore::GlyphPageTreeNode::pruneFontData):
+
 2012-09-07  Arvid Nilsson  <[email protected]>
 
         [CSS Shaders] WebKitCSSMixFunctionValue.h needs forward declaration of MemoryObjectInfo

Modified: trunk/Source/WebCore/WebCore.exp.in (127931 => 127932)


--- trunk/Source/WebCore/WebCore.exp.in	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-09-07 22:58:56 UTC (rev 127932)
@@ -394,7 +394,7 @@
 __ZN7WebCore16DeviceMotionData12Acceleration6createEbdbdbd
 __ZN7WebCore16DeviceMotionData12RotationRate6createEbdbdbd
 __ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd
-__ZNK7WebCore16FontFallbackList15releaseFontDataEv
+__ZN7WebCore16FontFallbackList15releaseFontDataEv
 __ZN7WebCore16FontPlatformDataD1Ev
 __ZN7WebCore16HTMLInputElement13setAutofilledEb
 __ZN7WebCore16HTMLInputElement15setEditingValueERKN3WTF6StringE

Modified: trunk/Source/WebCore/css/CSSFontFaceSource.cpp (127931 => 127932)


--- trunk/Source/WebCore/css/CSSFontFaceSource.cpp	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.cpp	2012-09-07 22:58:56 UTC (rev 127932)
@@ -167,7 +167,7 @@
                     return 0;
 
                 fontData = adoptPtr(new SimpleFontData(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDescription.orientation(),
-                                                                                          fontDescription.textOrientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false));
+                                                                                   fontDescription.textOrientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false));
             }
         } else {
 #if ENABLE(SVG_FONTS)
@@ -187,7 +187,12 @@
         fontData = adoptPtr(new SimpleFontData(temporaryFont->platformData(), true, true));
     }
 
-    return fontData.leakPtr();
+    if (Document* document = fontSelector->document()) {
+        cachedData = fontData.get();
+        document->registerCustomFont(fontData.release());
+    }
+
+    return cachedData;
 }
 
 #if ENABLE(SVG_FONTS)

Modified: trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp (127931 => 127932)


--- trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/css/CSSSegmentedFontFace.cpp	2012-09-07 22:58:56 UTC (rev 127932)
@@ -124,10 +124,14 @@
             appendFontDataWithInvalidUnicodeRangeIfLoading(newFontData.get(), faceFontData, m_fontFaces[i]->ranges());
         }
     }
-    if (newFontData->numRanges())
-        return newFontData.leakPtr();
+    if (newFontData->numRanges()) {
+        if (Document* document = m_fontSelector->document()) {
+            fontData = newFontData.get();
+            document->registerCustomFont(newFontData.release());
+        }
+    }
 
-    return 0;
+    return fontData;
 }
 
 }

Modified: trunk/Source/WebCore/dom/Document.cpp (127931 => 127932)


--- trunk/Source/WebCore/dom/Document.cpp	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-09-07 22:58:56 UTC (rev 127932)
@@ -658,6 +658,8 @@
             (*m_userSheets)[i]->clearOwnerNode();
     }
 
+    deleteCustomFonts();
+
     m_weakReference->clear();
 
     if (m_mediaQueryMatcher)
@@ -1976,6 +1978,20 @@
     return style.release();
 }
 
+void Document::registerCustomFont(PassOwnPtr<FontData> fontData)
+{
+    m_customFonts.append(fontData);
+}
+
+void Document::deleteCustomFonts()
+{
+    size_t size = m_customFonts.size();
+    for (size_t i = 0; i < size; ++i)
+        GlyphPageTreeNode::pruneTreeCustomFontData(m_customFonts[i].get());
+
+    m_customFonts.clear();
+}
+
 bool Document::isPageBoxVisible(int pageIndex)
 {
     RefPtr<RenderStyle> style = styleForPage(pageIndex);
@@ -6102,6 +6118,7 @@
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
     info.addInstrumentedMember(m_styleResolver);
     ContainerNode::reportMemoryUsage(memoryObjectInfo);
+    info.addVector(m_customFonts);
     info.addInstrumentedMember(m_url);
     info.addInstrumentedMember(m_baseURL);
     info.addInstrumentedMember(m_baseURLOverride);

Modified: trunk/Source/WebCore/dom/Document.h (127931 => 127932)


--- trunk/Source/WebCore/dom/Document.h	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/dom/Document.h	2012-09-07 22:58:56 UTC (rev 127932)
@@ -90,6 +90,7 @@
 class EventListener;
 class FloatRect;
 class FloatQuad;
+class FontData;
 class FormController;
 class Frame;
 class FrameView;
@@ -568,6 +569,8 @@
     PassRefPtr<RenderStyle> styleForElementIgnoringPendingStylesheets(Element*);
     PassRefPtr<RenderStyle> styleForPage(int pageIndex);
 
+    void registerCustomFont(PassOwnPtr<FontData>);
+
     // Returns true if page box (margin boxes and page borders) is visible.
     bool isPageBoxVisible(int pageIndex);
 
@@ -1245,6 +1248,8 @@
     void seamlessParentUpdatedStylesheets();
     void notifySeamlessChildDocumentsOfStylesheetUpdate() const;
 
+    void deleteCustomFonts();
+
     PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const;
 
     void loadEventDelayTimerFired(Timer<Document>*);
@@ -1278,6 +1283,7 @@
     OwnPtr<StyleResolver> m_styleResolver;
     bool m_didCalculateStyleResolver;
     bool m_hasDirtyStyleResolver;
+    Vector<OwnPtr<FontData> > m_customFonts;
 
     Frame* m_frame;
     RefPtr<DOMWindow> m_domWindow;

Modified: trunk/Source/WebCore/platform/graphics/FontData.h (127931 => 127932)


--- trunk/Source/WebCore/platform/graphics/FontData.h	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/platform/graphics/FontData.h	2012-09-07 22:58:56 UTC (rev 127932)
@@ -29,17 +29,13 @@
 #include <wtf/FastAllocBase.h>
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/RefCounted.h>
 #include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
 class SimpleFontData;
 
-// FIXME: The RefCounted functionality is only used by FontFallbackList for custom FontData.
-// The FontCache explicitly deletes FontData for non-custom fonts. All users of FontData should
-// be refactored to use RefPtr. https://bugs.webkit.org/show_bug.cgi?id=95866
-class FontData : public RefCounted<FontData> {
+class FontData {
     WTF_MAKE_NONCOPYABLE(FontData); WTF_MAKE_FAST_ALLOCATED;
 public:
     FontData()

Modified: trunk/Source/WebCore/platform/graphics/FontFallbackList.cpp (127931 => 127932)


--- trunk/Source/WebCore/platform/graphics/FontFallbackList.cpp	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/platform/graphics/FontFallbackList.cpp	2012-09-07 22:58:56 UTC (rev 127932)
@@ -32,7 +32,6 @@
 #include "Font.h"
 #include "FontCache.h"
 #include "SegmentedFontData.h"
-#include <wtf/ListHashSet.h>
 
 namespace WebCore {
 
@@ -63,26 +62,11 @@
     m_generation = fontCache()->generation();
 }
 
-void FontFallbackList::appendFontData(const FontData* fontData) const
+void FontFallbackList::releaseFontData()
 {
-    bool isCustomFont = fontData->isCustomFont();
-    m_fontList.append(pair<const FontData*, IsCustomFontOrNot>(fontData, isCustomFont ? IsCustomFont : IsNotCustomFont));
-    if (isCustomFont) {
-        // This FontFallbackList is using a FontData object that we wish to live while in use
-        // by any FontFallbackList, so increment its ref count.
-        const_cast<FontData*>(fontData)->ref();
-    }
-}
-
-void FontFallbackList::releaseFontData() const
-{
     unsigned numFonts = m_fontList.size();
     for (unsigned i = 0; i < numFonts; ++i) {
-        if (m_fontList[i].second == IsCustomFont) {
-            // This FontFallbackList no longer requires the custom FontData, so deref. If we are the
-            // last FontFallbackList using this custom FontData, it will be deleted.
-            const_cast<FontData*>(m_fontList[i].first)->deref();
-        } else {
+        if (!m_fontList[i].second) {
             ASSERT(!m_fontList[i].first->isSegmented());
             fontCache()->releaseFontData(static_cast<const SimpleFontData*>(m_fontList[i].first));
         }
@@ -122,7 +106,7 @@
     ASSERT(fontCache()->generation() == m_generation);
     const FontData* result = fontCache()->getFontData(*font, m_familyIndex, m_fontSelector.get());
     if (result) {
-        appendFontData(result);
+        m_fontList.append(pair<const FontData*, bool>(result, result->isCustomFont()));
         if (result->isLoading())
             m_loadingCustomFonts = true;
     }
@@ -134,7 +118,7 @@
     m_familyIndex = cAllFamiliesScanned;
     ASSERT(fontCache()->generation() == m_generation);
     const FontData* fontData = fontCache()->getCachedFontData(&platformData);
-    appendFontData(fontData);
+    m_fontList.append(pair<const FontData*, bool>(fontData, fontData->isCustomFont()));
 }
 
 }

Modified: trunk/Source/WebCore/platform/graphics/FontFallbackList.h (127931 => 127932)


--- trunk/Source/WebCore/platform/graphics/FontFallbackList.h	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/platform/graphics/FontFallbackList.h	2012-09-07 22:58:56 UTC (rev 127932)
@@ -39,7 +39,6 @@
 const int cAllFamiliesScanned = -1;
 
 class FontFallbackList : public RefCounted<FontFallbackList> {
-    WTF_MAKE_NONCOPYABLE(FontFallbackList);
 public:
     static PassRefPtr<FontFallbackList> create() { return adoptRef(new FontFallbackList()); }
 
@@ -64,7 +63,9 @@
     const GlyphPages& glyphPages() const { return m_pages; }
 
 private:
-    enum IsCustomFontOrNot { IsNotCustomFont, IsCustomFont };
+    friend class SVGTextRunRenderingContext;
+    void setGlyphPageZero(GlyphPageTreeNode* pageZero) { m_pageZero = pageZero; }
+    void setGlyphPages(const GlyphPages& pages) { m_pages = pages; }
 
     FontFallbackList();
 
@@ -81,18 +82,9 @@
 
     void setPlatformFont(const FontPlatformData&);
 
-    void setGlyphPageZero(GlyphPageTreeNode* pageZero) { m_pageZero = pageZero; }
-    void setGlyphPages(const GlyphPages& pages) { m_pages = pages; }
+    void releaseFontData();
 
-    void appendFontData(const FontData*) const;
-    void releaseFontData() const;
-
-    // A custom FontData pointer in this Vector is owned by FontFallbackList and
-    // deleted when no FontFallbackList is using it. A non-custom FontData pointer
-    // is owned by the FontCache and is deleted when the font is purged.
-    // FIXME: Shift to RefPtr for all FontData objects and modify this pair to be a custom class.
-    // https://bugs.webkit.org/show_bug.cgi?id=95866
-    mutable Vector<pair<const FontData*, IsCustomFontOrNot>, 1> m_fontList;
+    mutable Vector<pair<const FontData*, bool>, 1> m_fontList;
     mutable GlyphPages m_pages;
     mutable GlyphPageTreeNode* m_pageZero;
     mutable const SimpleFontData* m_cachedPrimarySimpleFontData;
@@ -104,7 +96,6 @@
     mutable bool m_loadingCustomFonts : 1;
 
     friend class Font;
-    friend class SVGTextRunRenderingContext;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp (127931 => 127932)


--- trunk/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp	2012-09-07 22:55:23 UTC (rev 127931)
+++ trunk/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp	2012-09-07 22:58:56 UTC (rev 127932)
@@ -374,6 +374,8 @@
 void GlyphPageTreeNode::pruneFontData(const SimpleFontData* fontData, unsigned level)
 {
     ASSERT(fontData);
+    if (!fontData)
+        return;
 
     // Prune fall back child (if any) of this font.
     if (m_systemFallbackChild && m_systemFallbackChild->m_page)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to