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

Unified Diff: third_party/WebKit/Source/web/WebKit.cpp

Issue 1491253004: Release Oilpan heap singletons prior to LSan leak detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address non-LSan Oilpan compilation failure Created 5 years 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/web/WebKit.cpp
diff --git a/third_party/WebKit/Source/web/WebKit.cpp b/third_party/WebKit/Source/web/WebKit.cpp
index c892d8b06b2c170be6d89a38a70f71033ec2914e..f6375b0ad367a324edcdb4297a9d97207a419b5e 100644
--- a/third_party/WebKit/Source/web/WebKit.cpp
+++ b/third_party/WebKit/Source/web/WebKit.cpp
@@ -195,6 +195,21 @@ void initializeWithoutV8(Platform* platform)
void shutdown()
{
+#if defined(LEAK_SANITIZER)
+ // If LSan is about to perform leak detection, release all the registered
+ // static Persistent<> root references to global caches that Blink keeps,
+ // followed by GCs to clear out all they referred to. A full v8 GC cycle
+ // is needed to flush out all garbage.
+ //
+ // This is not needed for caches over non-Oilpan objects, as they're
+ // not scanned by LSan due to being held in non-global storage
+ // ("static" references inside functions/methods.)
+ if (ThreadState* threadState = ThreadState::current()) {
+ threadState->releaseStaticPersistentNodes();
+ Heap::collectAllGarbage();
+ }
+#endif
+
// currentThread() is null if we are running on a thread without a message loop.
if (Platform::current()->currentThread()) {
Platform::current()->unregisterMemoryDumpProvider(WebCacheMemoryDumpProvider::instance());
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.cpp ('k') | third_party/WebKit/Source/wtf/BitVector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698