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

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

Issue 1771353010: Finish completeSweep before shutting down V8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/ThreadState.cpp
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
index 8446223a5880b38e074f72b38ad995b6393ba25a..91457e541122b590979f28d8c28bd2028862177a 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -209,6 +209,16 @@ void ThreadState::attachMainThread()
attachedThreads().add(state);
}
+
+void ThreadState::stopMainThread()
+{
+ ASSERT(isMainThread());
+
+ // Finish sweeping before shutting down V8. Otherwise, some destructor
+ // may access V8 and cause crashes.
+ completeSweep();
+}
+
void ThreadState::detachMainThread()
{
// Enter a safe point before trying to acquire threadAttachMutex
@@ -218,23 +228,17 @@ void ThreadState::detachMainThread()
ThreadState* state = mainThreadState();
ASSERT(state == ThreadState::current());
ASSERT(state->checkThread());
- // You must call unregisterTraceDOMWrappers before detaching
- // the main thread.
- ASSERT(!state->m_isolate);
+ ASSERT(!state->isSweepingInProgress());
- // 1. Finish sweeping.
- state->completeSweep();
- {
- SafePointAwareMutexLocker locker(threadAttachMutex(), BlinkGC::NoHeapPointersOnStack);
+ SafePointAwareMutexLocker locker(threadAttachMutex(), BlinkGC::NoHeapPointersOnStack);
haraken 2016/03/10 07:28:53 Ah, now I remember why I had to clear state->m_iso
sof 2016/03/10 07:35:41 If you add an assert or two to capture those assum
- // 2. Add the main thread's heap pages to the orphaned pool.
- state->cleanupPages();
+ // Add the main thread's heap pages to the orphaned pool.
+ state->cleanupPages();
- // 3. Detach the main thread.
- ASSERT(attachedThreads().contains(state));
- attachedThreads().remove(state);
- state->~ThreadState();
- }
+ // Detach the main thread.
+ ASSERT(attachedThreads().contains(state));
+ attachedThreads().remove(state);
+ state->~ThreadState();
}
void ThreadState::attach()
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698