Index: third_party/WebKit/Source/platform/heap/CallbackStack.cpp |
diff --git a/third_party/WebKit/Source/platform/heap/CallbackStack.cpp b/third_party/WebKit/Source/platform/heap/CallbackStack.cpp |
index a80bd4e432d597fe58991722ee779b483855882b..7a13b0b32f3a24d94aef0ebf9cbc6767e19d92a7 100644 |
--- a/third_party/WebKit/Source/platform/heap/CallbackStack.cpp |
+++ b/third_party/WebKit/Source/platform/heap/CallbackStack.cpp |
@@ -45,11 +45,15 @@ void CallbackStack::Block::clear() |
void CallbackStack::Block::decommit() |
{ |
+ reset(); |
+ WTF::discardSystemPages(m_buffer, m_blockSize * sizeof(Item)); |
+} |
+ |
+void CallbackStack::Block::reset() |
+{ |
#if ENABLE(ASSERT) |
clear(); |
#endif |
- WTF::discardSystemPages(m_buffer, m_blockSize * sizeof(Item)); |
- |
m_current = &m_buffer[0]; |
m_next = nullptr; |
} |
@@ -90,6 +94,17 @@ CallbackStack::~CallbackStack() |
m_last = nullptr; |
} |
+void CallbackStack::clear() |
+{ |
+ Block* next; |
+ for (Block* current = m_first->next(); current; current = next) { |
+ next = current->next(); |
+ delete current; |
+ } |
+ m_first->reset(); |
+ m_last = m_first; |
+} |
+ |
void CallbackStack::decommit() |
{ |
Block* next; |