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

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

Issue 154263007: Let V8 know about the external memory owned by large StaticNodeList (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « Source/core/dom/StaticNodeList.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/StaticNodeList.cpp
diff --git a/Source/core/dom/StaticNodeList.cpp b/Source/core/dom/StaticNodeList.cpp
index d9bf28e1f5b79c2b34f86d8b8b2268616c95d605..ba3cfb3eb59ca0bb56a532997f9c2acc15a33b53 100644
--- a/Source/core/dom/StaticNodeList.cpp
+++ b/Source/core/dom/StaticNodeList.cpp
@@ -33,6 +33,21 @@
namespace WebCore {
+PassRefPtr<StaticNodeList> StaticNodeList::adopt(Vector<RefPtr<Node> >& nodes)
+{
+ RefPtr<StaticNodeList> nodeList = adoptRef(new StaticNodeList);
+ nodeList->m_nodes.swap(nodes);
+ if (nodeList->AllocationSize() > externalMemoryReportSizeLimit)
+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(nodeList->AllocationSize());
+ return nodeList.release();
+}
+
+StaticNodeList::~StaticNodeList()
+{
+ if (AllocationSize() > externalMemoryReportSizeLimit)
+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-AllocationSize());
+}
+
unsigned StaticNodeList::length() const
{
return m_nodes.size();
« no previous file with comments | « Source/core/dom/StaticNodeList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698