Don't allocate RenderNamedFlowThread's child list separately.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Feb 2014 03:51:06 +0000 (03:51 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Feb 2014 03:51:06 +0000 (03:51 +0000)
<https://webkit.org/b/128640>

Since we always create the flow-thread child list, there's no reason
to put it in a separate heap allocation. Also remove the typedef and
use auto instead.

Reviewed by Anders Carlsson.

* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::RenderNamedFlowThread):
(WebCore::RenderNamedFlowThread::nextRendererForNode):
(WebCore::RenderNamedFlowThread::addFlowChild):
(WebCore::RenderNamedFlowThread::removeFlowChild):
* rendering/RenderNamedFlowThread.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163933 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderNamedFlowThread.cpp
Source/WebCore/rendering/RenderNamedFlowThread.h

index dfba7102701030e1019854cef1cf83a8a6c87d66..3eac8ddad532fb656b3cbfbd00f720ab9fa60833 100644 (file)
@@ -1,3 +1,21 @@
+2014-02-11  Andreas Kling  <akling@apple.com>
+
+        Don't allocate RenderNamedFlowThread's child list separately.
+        <https://webkit.org/b/128640>
+
+        Since we always create the flow-thread child list, there's no reason
+        to put it in a separate heap allocation. Also remove the typedef and
+        use auto instead.
+
+        Reviewed by Anders Carlsson.
+
+        * rendering/RenderNamedFlowThread.cpp:
+        (WebCore::RenderNamedFlowThread::RenderNamedFlowThread):
+        (WebCore::RenderNamedFlowThread::nextRendererForNode):
+        (WebCore::RenderNamedFlowThread::addFlowChild):
+        (WebCore::RenderNamedFlowThread::removeFlowChild):
+        * rendering/RenderNamedFlowThread.h:
+
 2014-02-11  Zalan Bujtas  <zalan@apple.com>
 
         Subpixel rendering: Make GraphicsLayerClient::paintContents's clip rect subpixel based.
index e0784fab81486c048e726588c7315059f2f96f63..102dfea22b88fc7b2e86175cd51332432e217f67 100644 (file)
@@ -47,7 +47,6 @@ namespace WebCore {
 
 RenderNamedFlowThread::RenderNamedFlowThread(Document& document, PassRef<RenderStyle> style, PassRef<WebKitNamedFlow> namedFlow)
     : RenderFlowThread(document, std::move(style))
-    , m_flowThreadChildList(adoptPtr(new FlowThreadChildList()))
     , m_overset(true)
     , m_hasRegionsWithStyling(false)
     , m_namedFlow(std::move(namedFlow))
@@ -100,8 +99,7 @@ void RenderNamedFlowThread::updateWritingMode()
 
 RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const
 {
-    const FlowThreadChildList& childList = *(m_flowThreadChildList.get());
-    for (auto& child : childList) {
+    for (auto& child : m_flowThreadChildList) {
         ASSERT(child->node());
         unsigned short position = node->compareDocumentPosition(child->node());
         if (position & Node::DOCUMENT_POSITION_FOLLOWING)
@@ -126,14 +124,14 @@ void RenderNamedFlowThread::addFlowChild(RenderObject* newChild)
 
     RenderObject* beforeChild = nextRendererForNode(childNode);
     if (beforeChild)
-        m_flowThreadChildList->insertBefore(beforeChild, newChild);
+        m_flowThreadChildList.insertBefore(beforeChild, newChild);
     else
-        m_flowThreadChildList->add(newChild);
+        m_flowThreadChildList.add(newChild);
 }
 
 void RenderNamedFlowThread::removeFlowChild(RenderObject* child)
 {
-    m_flowThreadChildList->remove(child);
+    m_flowThreadChildList.remove(child);
 }
 
 bool RenderNamedFlowThread::dependsOn(RenderNamedFlowThread* otherRenderFlowThread) const
index 4e2ba8c53e03c3127123c2421806e90c507e4030..b147a2a706112f9766ec63df1de0e24c0e307d2e 100644 (file)
@@ -56,9 +56,9 @@ public:
 
     void addFlowChild(RenderObject* newChild);
     void removeFlowChild(RenderObject*);
-    bool hasChildren() const { return !m_flowThreadChildList->isEmpty(); }
+    bool hasChildren() const { return !m_flowThreadChildList.isEmpty(); }
 #ifndef NDEBUG
-    bool hasChild(RenderObject* child) const { return m_flowThreadChildList->contains(child); }
+    bool hasChild(RenderObject* child) const { return m_flowThreadChildList.contains(child); }
 #endif
 
     void pushDependencies(RenderNamedFlowThreadList&);
@@ -129,8 +129,7 @@ private:
     RenderNamedFlowThreadCountedSet m_layoutBeforeThreadsSet;
 
     // Holds the sorted children of a named flow. This is the only way we can get the ordering right.
-    typedef ListHashSet<RenderObject*> FlowThreadChildList;
-    OwnPtr<FlowThreadChildList> m_flowThreadChildList;
+    ListHashSet<RenderObject*> m_flowThreadChildList;
 
     NamedFlowContentElements m_contentElements;