Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: Source/core/dom/StaticNodeList.cpp

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase needed Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/StaticNodeList.cpp
diff --git a/Source/core/dom/StaticNodeList.cpp b/Source/core/dom/StaticNodeList.cpp
index ba3cfb3eb59ca0bb56a532997f9c2acc15a33b53..d5b01767deab4146bf13b30e499467c8dd487013 100644
--- a/Source/core/dom/StaticNodeList.cpp
+++ b/Source/core/dom/StaticNodeList.cpp
@@ -33,10 +33,17 @@
namespace WebCore {
-PassRefPtr<StaticNodeList> StaticNodeList::adopt(Vector<RefPtr<Node> >& nodes)
+PassRefPtrWillBeRawPtr<StaticNodeList> StaticNodeList::adopt(Vector<RefPtr<Node> >& nodes)
{
- RefPtr<StaticNodeList> nodeList = adoptRef(new StaticNodeList);
+ RefPtrWillBeRawPtr<StaticNodeList> nodeList = adoptRefWillBeNoop(new StaticNodeList);
+#if ENABLE(OILPAN)
+ // FIXME: Oilpan: switch to a WillBeHeapVector<RefPtrWillBeMember<>> argument.
+ for (size_t i = 0; i < nodes.size(); i++)
tkent 2014/05/19 07:23:40 nit: We prefer ++i.
+ nodeList->m_nodes.append(nodes[i]);
+ nodes.clear();
+#else
nodeList->m_nodes.swap(nodes);
+#endif
if (nodeList->AllocationSize() > externalMemoryReportSizeLimit)
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeList->AllocationSize());
return nodeList.release();
@@ -60,4 +67,10 @@ Node* StaticNodeList::item(unsigned index) const
return 0;
}
+void StaticNodeList::trace(Visitor* visitor)
+{
+ visitor->trace(m_nodes);
+ NodeList::trace(visitor);
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698