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

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

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 | « no previous file | Source/core/dom/StaticNodeList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/StaticNodeList.h
diff --git a/Source/core/dom/StaticNodeList.h b/Source/core/dom/StaticNodeList.h
index 5fad9de1ce8053831f769e5a5f2a54eb3185e449..1875132d4fdc6ffa053ad58d805986c3ceaca822 100644
--- a/Source/core/dom/StaticNodeList.h
+++ b/Source/core/dom/StaticNodeList.h
@@ -41,22 +41,28 @@ class Node;
class StaticNodeList FINAL : public NodeList {
public:
- static PassRefPtr<StaticNodeList> adopt(Vector<RefPtr<Node> >& nodes)
- {
- RefPtr<StaticNodeList> nodeList = adoptRef(new StaticNodeList);
- nodeList->m_nodes.swap(nodes);
- return nodeList.release();
- }
+ static PassRefPtr<StaticNodeList> adopt(Vector<RefPtr<Node> >& nodes);
static PassRefPtr<StaticNodeList> createEmpty()
{
return adoptRef(new StaticNodeList);
}
+ virtual ~StaticNodeList();
+
virtual unsigned length() const OVERRIDE;
virtual Node* item(unsigned index) const OVERRIDE;
private:
+ // If AllocationSize() is larger than this, we report it as external
+ // allocated memory to V8.
+ const static ptrdiff_t externalMemoryReportSizeLimit = 1024;
+
+ ptrdiff_t AllocationSize()
+ {
+ return m_nodes.capacity() * sizeof(RefPtr<Node>);
+ }
+
Vector<RefPtr<Node> > m_nodes;
};
« no previous file with comments | « no previous file | Source/core/dom/StaticNodeList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698