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

Side by Side Diff: third_party/WebKit/Source/platform/heap/ThreadState.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: renamings + switch to using LEAK_SANITIZER_DISABLED_SCOPE 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 , m_vectorBackingHeapIndex(BlinkGC::Vector1HeapIndex) 97 , m_vectorBackingHeapIndex(BlinkGC::Vector1HeapIndex)
98 , m_currentHeapAges(0) 98 , m_currentHeapAges(0)
99 , m_isTerminating(false) 99 , m_isTerminating(false)
100 , m_gcMixinMarker(nullptr) 100 , m_gcMixinMarker(nullptr)
101 , m_shouldFlushHeapDoesNotContainCache(false) 101 , m_shouldFlushHeapDoesNotContainCache(false)
102 , m_gcState(NoGCScheduled) 102 , m_gcState(NoGCScheduled)
103 , m_traceDOMWrappers(nullptr) 103 , m_traceDOMWrappers(nullptr)
104 #if defined(ADDRESS_SANITIZER) 104 #if defined(ADDRESS_SANITIZER)
105 , m_asanFakeStack(__asan_get_current_fake_stack()) 105 , m_asanFakeStack(__asan_get_current_fake_stack())
106 #endif 106 #endif
107 #if defined(LEAK_SANITIZER)
108 , m_disabledStaticPersistentsRegistration(0)
109 #endif
107 { 110 {
108 ASSERT(checkThread()); 111 ASSERT(checkThread());
109 ASSERT(!**s_threadSpecific); 112 ASSERT(!**s_threadSpecific);
110 **s_threadSpecific = this; 113 **s_threadSpecific = this;
111 114
112 if (isMainThread()) { 115 if (isMainThread()) {
113 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s izeof(void*); 116 s_mainThreadStackStart = reinterpret_cast<uintptr_t>(m_startOfStack) - s izeof(void*);
114 size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStack Size(); 117 size_t underestimatedStackSize = StackFrameDepth::getUnderestimatedStack Size();
115 if (underestimatedStackSize > sizeof(void*)) 118 if (underestimatedStackSize > sizeof(void*))
116 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size of(void*); 119 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size of(void*);
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 ASSERT(checkThread()); 1313 ASSERT(checkThread());
1311 SafePointScope scope(BlinkGC::HeapPointersOnStack); 1314 SafePointScope scope(BlinkGC::HeapPointersOnStack);
1312 { 1315 {
1313 MutexLocker locker(threadAttachMutex()); 1316 MutexLocker locker(threadAttachMutex());
1314 size_t index = m_interruptors.find(interruptor); 1317 size_t index = m_interruptors.find(interruptor);
1315 RELEASE_ASSERT(index != kNotFound); 1318 RELEASE_ASSERT(index != kNotFound);
1316 m_interruptors.remove(index); 1319 m_interruptors.remove(index);
1317 } 1320 }
1318 } 1321 }
1319 1322
1323 #if defined(LEAK_SANITIZER)
1324 void ThreadState::registerStaticPersistentNode(PersistentNode* node)
1325 {
1326 if (m_disabledStaticPersistentsRegistration)
1327 return;
1328
1329 ASSERT(!m_staticPersistents.contains(node));
1330 m_staticPersistents.add(node);
1331 }
1332
1333 void ThreadState::releaseStaticPersistentNodes()
1334 {
1335 for (PersistentNode* node : m_staticPersistents)
1336 persistentRegion()->freePersistentNode(node);
haraken 2015/12/07 14:46:10 After calling this, all static Persistent handles
sof 2015/12/07 16:59:17 Intentional to handle it that way; the sweeping ph
1337
1338 m_staticPersistents.clear();
1339 }
1340
1341 void ThreadState::enterStaticReferenceRegistrationDisabledScope()
1342 {
1343 m_disabledStaticPersistentsRegistration++;
1344 }
1345
1346 void ThreadState::leaveStaticReferenceRegistrationDisabledScope()
1347 {
1348 ASSERT(m_disabledStaticPersistentsRegistration);
1349 m_disabledStaticPersistentsRegistration--;
1350 }
1351 #endif
1352
1320 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads() 1353 ThreadState::AttachedThreadStateSet& ThreadState::attachedThreads()
1321 { 1354 {
1322 DEFINE_STATIC_LOCAL(AttachedThreadStateSet, threads, ()); 1355 DEFINE_STATIC_LOCAL(AttachedThreadStateSet, threads, ());
1323 return threads; 1356 return threads;
1324 } 1357 }
1325 1358
1326 void ThreadState::lockThreadAttachMutex() 1359 void ThreadState::lockThreadAttachMutex()
1327 { 1360 {
1328 threadAttachMutex().lock(); 1361 threadAttachMutex().lock();
1329 } 1362 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 threadDump->addScalar("dead_count", "objects", totalDeadCount); 1516 threadDump->addScalar("dead_count", "objects", totalDeadCount);
1484 threadDump->addScalar("live_size", "bytes", totalLiveSize); 1517 threadDump->addScalar("live_size", "bytes", totalLiveSize);
1485 threadDump->addScalar("dead_size", "bytes", totalDeadSize); 1518 threadDump->addScalar("dead_size", "bytes", totalDeadSize);
1486 1519
1487 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); 1520 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName);
1488 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName); 1521 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName);
1489 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid()); 1522 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid());
1490 } 1523 }
1491 1524
1492 } // namespace blink 1525 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698