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

Unified Diff: third_party/WebKit/Source/platform/heap/CallbackStack.cpp

Issue 2036803004: Reset ThreadState weak callback stack before GCing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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: 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;
« no previous file with comments | « third_party/WebKit/Source/platform/heap/CallbackStack.h ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698