| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 { | 172 { |
| 173 // Grab the threadAttachMutex to ensure only one thread can shutdown at | 173 // Grab the threadAttachMutex to ensure only one thread can shutdown at |
| 174 // a time and that no other thread can do a global GC. It also allows | 174 // a time and that no other thread can do a global GC. It also allows |
| 175 // safe iteration of the m_threads set which happens as part of | 175 // safe iteration of the m_threads set which happens as part of |
| 176 // thread local GC asserts. We enter a safepoint while waiting for the | 176 // thread local GC asserts. We enter a safepoint while waiting for the |
| 177 // lock to avoid a dead-lock where another thread has already requested | 177 // lock to avoid a dead-lock where another thread has already requested |
| 178 // GC. | 178 // GC. |
| 179 MutexLocker locker(m_threadAttachMutex); | 179 MutexLocker locker(m_threadAttachMutex); |
| 180 thread->runTerminationGC(); | 180 thread->runTerminationGC(); |
| 181 ASSERT(m_threads.contains(thread)); | 181 ASSERT(m_threads.contains(thread)); |
| 182 m_threads.remove(thread); | 182 m_threads.erase(thread); |
| 183 isLastThread = m_threads.isEmpty(); | 183 isLastThread = m_threads.isEmpty(); |
| 184 } | 184 } |
| 185 if (thread->isMainThread()) | 185 if (thread->isMainThread()) |
| 186 DCHECK_EQ(heapStats().allocatedSpace(), 0u); | 186 DCHECK_EQ(heapStats().allocatedSpace(), 0u); |
| 187 if (isLastThread) | 187 if (isLastThread) |
| 188 delete this; | 188 delete this; |
| 189 } | 189 } |
| 190 | 190 |
| 191 #if DCHECK_IS_ON() | 191 #if DCHECK_IS_ON() |
| 192 BasePage* ThreadHeap::findPageFromAddress(Address address) { | 192 BasePage* ThreadHeap::findPageFromAddress(Address address) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 564 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); |
| 565 | 565 |
| 566 m_stats.reset(); | 566 m_stats.reset(); |
| 567 for (ThreadState* state : m_threads) | 567 for (ThreadState* state : m_threads) |
| 568 state->resetHeapCounters(); | 568 state->resetHeapCounters(); |
| 569 } | 569 } |
| 570 | 570 |
| 571 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 571 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; |
| 572 | 572 |
| 573 } // namespace blink | 573 } // namespace blink |
| OLD | NEW |