Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 MutexLocker locker(threadAttachMutex()); | 206 MutexLocker locker(threadAttachMutex()); |
| 207 ThreadState* state = new (s_mainThreadStateStorage) ThreadState(); | 207 ThreadState* state = new (s_mainThreadStateStorage) ThreadState(); |
| 208 attachedThreads().add(state); | 208 attachedThreads().add(state); |
| 209 } | 209 } |
| 210 | 210 |
| 211 | 211 |
| 212 void ThreadState::cleanupMainThread() | 212 void ThreadState::cleanupMainThread() |
| 213 { | 213 { |
| 214 ASSERT(isMainThread()); | 214 ASSERT(isMainThread()); |
| 215 | 215 |
| 216 #if defined(LEAK_SANITIZER) | |
| 217 // If LSan is about to perform leak detection, release all the registered | |
| 218 // static Persistent<> root references to global caches that Blink keeps, | |
| 219 // followed by GCs to clear out all they referred to. | |
|
haraken
2016/03/11 09:18:05
I forgot the details about this.
Why is it okay t
sof
2016/03/11 09:36:18
For the purposes of overall leak detection, we are
| |
| 220 // | |
| 221 // This is not needed for caches over non-Oilpan objects, as they're | |
| 222 // not scanned by LSan due to being held in non-global storage | |
| 223 // ("static" references inside functions/methods.) | |
| 224 releaseStaticPersistentNodes(); | |
| 225 Heap::collectAllGarbage(); | |
| 226 #endif | |
| 227 | |
| 216 // Finish sweeping before shutting down V8. Otherwise, some destructor | 228 // Finish sweeping before shutting down V8. Otherwise, some destructor |
| 217 // may access V8 and cause crashes. | 229 // may access V8 and cause crashes. |
| 218 completeSweep(); | 230 completeSweep(); |
| 219 | 231 |
| 220 // It is unsafe to trigger GCs after this point because some | 232 // It is unsafe to trigger GCs after this point because some |
| 221 // destructor may access already-detached V8 and cause crashes. | 233 // destructor may access already-detached V8 and cause crashes. |
| 222 // Also it is useless. So we forbid GCs. | 234 // Also it is useless. So we forbid GCs. |
| 223 enterGCForbiddenScope(); | 235 enterGCForbiddenScope(); |
| 224 } | 236 } |
| 225 | 237 |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1547 threadDump->addScalar("dead_count", "objects", totalDeadCount); | 1559 threadDump->addScalar("dead_count", "objects", totalDeadCount); |
| 1548 threadDump->addScalar("live_size", "bytes", totalLiveSize); | 1560 threadDump->addScalar("live_size", "bytes", totalLiveSize); |
| 1549 threadDump->addScalar("dead_size", "bytes", totalDeadSize); | 1561 threadDump->addScalar("dead_size", "bytes", totalDeadSize); |
| 1550 | 1562 |
| 1551 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1563 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
| 1552 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1564 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
| 1553 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid()); | 1565 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid()); |
| 1554 } | 1566 } |
| 1555 | 1567 |
| 1556 } // namespace blink | 1568 } // namespace blink |
| OLD | NEW |