Title: [137717] trunk/Source/WebCore
Revision
137717
Author
morr...@google.com
Date
2012-12-13 23:45:46 -0800 (Thu, 13 Dec 2012)

Log Message

ContentDistributor and ShadowRootContentDistributionData should use RefPtr to hold elements.
https://bugs.webkit.org/show_bug.cgi?id=104918

Reviewed by Kentaro Hara.

This change turns some raw pointers to RefPtrs.

No new tests. Hard to write reliable fast tests since the error
reproduction needs GC to run in certain timing. Although original
report has a repdocution, it takes a few seconds before crash and
isn't suited for a layout test.

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::insertionPointList):
* dom/ShadowRoot.h:
(ShadowRoot):
* html/shadow/ContentDistributor.cpp:
(WebCore::ShadowRootContentDistributionData::ensureInsertionPointList):
(WebCore::ContentDistributor::findInsertionPointFor):
(WebCore::ContentDistributor::distribute):
(WebCore::ContentDistributor::invalidate):
* html/shadow/ContentDistributor.h:
(ShadowRootContentDistributionData):
(ContentDistributor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (137716 => 137717)


--- trunk/Source/WebCore/ChangeLog	2012-12-14 07:30:53 UTC (rev 137716)
+++ trunk/Source/WebCore/ChangeLog	2012-12-14 07:45:46 UTC (rev 137717)
@@ -1,5 +1,32 @@
 2012-12-13  Hajime Morrita  <morr...@google.com>
 
+        ContentDistributor and ShadowRootContentDistributionData should use RefPtr to hold elements.
+        https://bugs.webkit.org/show_bug.cgi?id=104918
+
+        Reviewed by Kentaro Hara.
+
+        This change turns some raw pointers to RefPtrs.
+
+        No new tests. Hard to write reliable fast tests since the error
+        reproduction needs GC to run in certain timing. Although original
+        report has a repdocution, it takes a few seconds before crash and
+        isn't suited for a layout test.
+
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::insertionPointList):
+        * dom/ShadowRoot.h:
+        (ShadowRoot):
+        * html/shadow/ContentDistributor.cpp:
+        (WebCore::ShadowRootContentDistributionData::ensureInsertionPointList):
+        (WebCore::ContentDistributor::findInsertionPointFor):
+        (WebCore::ContentDistributor::distribute):
+        (WebCore::ContentDistributor::invalidate):
+        * html/shadow/ContentDistributor.h:
+        (ShadowRootContentDistributionData):
+        (ContentDistributor):
+
+2012-12-13  Hajime Morrita  <morr...@google.com>
+
         NodeRenderingContext is slow due to ComposedShadowTreeWalker
         https://bugs.webkit.org/show_bug.cgi?id=104332
 

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (137716 => 137717)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-12-14 07:30:53 UTC (rev 137716)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-12-14 07:45:46 UTC (rev 137717)
@@ -328,9 +328,9 @@
     owner()->invalidateDistribution();
 }
 
-const Vector<InsertionPoint*>& ShadowRoot::insertionPointList()
+const Vector<RefPtr<InsertionPoint> >& ShadowRoot::insertionPointList()
 {
-    typedef Vector<InsertionPoint*> InsertionPointVector;
+    typedef Vector<RefPtr<InsertionPoint> > InsertionPointVector;
     DEFINE_STATIC_LOCAL(InsertionPointVector, emptyVector, ());
 
     return distributionData() ? distributionData()->ensureInsertionPointList(this) : emptyVector;

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (137716 => 137717)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2012-12-14 07:30:53 UTC (rev 137716)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2012-12-14 07:45:46 UTC (rev 137717)
@@ -102,7 +102,7 @@
     bool hasElementShadow() const;
     unsigned countElementShadow() const;
 
-    const Vector<InsertionPoint*>& insertionPointList();
+    const Vector<RefPtr<InsertionPoint> >& insertionPointList();
 
     virtual void registerScopedHTMLStyleChild() OVERRIDE;
     virtual void unregisterScopedHTMLStyleChild() OVERRIDE;

Modified: trunk/Source/WebCore/html/shadow/ContentDistributor.cpp (137716 => 137717)


--- trunk/Source/WebCore/html/shadow/ContentDistributor.cpp	2012-12-14 07:30:53 UTC (rev 137716)
+++ trunk/Source/WebCore/html/shadow/ContentDistributor.cpp	2012-12-14 07:45:46 UTC (rev 137717)
@@ -91,7 +91,7 @@
     m_insertionPointList.clear();
 }
 
-const Vector<InsertionPoint*>& ShadowRootContentDistributionData::ensureInsertionPointList(ShadowRoot* shadowRoot)
+const Vector<RefPtr<InsertionPoint> >& ShadowRootContentDistributionData::ensureInsertionPointList(ShadowRoot* shadowRoot)
 {
     if (m_insertionPointListIsValid)
         return m_insertionPointList;
@@ -155,7 +155,7 @@
 
 InsertionPoint* ContentDistributor::findInsertionPointFor(const Node* key) const
 {
-    return m_nodeToInsertionPoint.get(key);
+    return m_nodeToInsertionPoint.get(key).get();
 }
 
 void ContentDistributor::populate(Node* node, ContentDistribution& pool)
@@ -193,9 +193,9 @@
     for (ShadowRoot* root = host->youngestShadowRoot(); root; root = root->olderShadowRoot()) {
         HTMLShadowElement* firstActiveShadowInsertionPoint = 0;
 
-        const Vector<InsertionPoint*>& insertionPoints = root->insertionPointList();
+        const Vector<RefPtr<InsertionPoint> >& insertionPoints = root->insertionPointList();
         for (size_t i = 0; i < insertionPoints.size(); ++i) {
-            InsertionPoint* point = insertionPoints[i];
+            InsertionPoint* point = insertionPoints[i].get();
             if (!point->isActive())
                 continue;
 
@@ -235,7 +235,7 @@
 
     for (ShadowRoot* root = host->youngestShadowRoot(); root; root = root->olderShadowRoot()) {
         root->setAssignedTo(0);
-        const Vector<InsertionPoint*>& insertionPoints = root->insertionPointList();
+        const Vector<RefPtr<InsertionPoint> >& insertionPoints = root->insertionPointList();
         for (size_t i = 0; i < insertionPoints.size(); ++i) {
             needsReattach = needsReattach || true;
             insertionPoints[i]->clearDistribution();

Modified: trunk/Source/WebCore/html/shadow/ContentDistributor.h (137716 => 137717)


--- trunk/Source/WebCore/html/shadow/ContentDistributor.h	2012-12-14 07:30:53 UTC (rev 137716)
+++ trunk/Source/WebCore/html/shadow/ContentDistributor.h	2012-12-14 07:45:46 UTC (rev 137717)
@@ -88,7 +88,7 @@
     bool hasElementShadowChildren() const { return m_numberOfElementShadowChildren > 0; }
 
     void invalidateInsertionPointList();
-    const Vector<InsertionPoint*>& ensureInsertionPointList(ShadowRoot*);
+    const Vector<RefPtr<InsertionPoint> >& ensureInsertionPointList(ShadowRoot*);
 
 private:
     InsertionPoint* m_insertionPointAssignedTo;
@@ -96,7 +96,7 @@
     unsigned m_numberOfContentElementChildren;
     unsigned m_numberOfElementShadowChildren;
     bool m_insertionPointListIsValid;
-    Vector<InsertionPoint*> m_insertionPointList;
+    Vector<RefPtr<InsertionPoint> > m_insertionPointList;
 };
 
 class ContentDistributor {
@@ -129,7 +129,7 @@
 private:
     void populate(Node*, ContentDistribution&);
 
-    HashMap<const Node*, InsertionPoint*> m_nodeToInsertionPoint;
+    HashMap<const Node*, RefPtr<InsertionPoint> > m_nodeToInsertionPoint;
     unsigned m_validity : 2;
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to