| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 script->evaluate(ScriptSourceCode(sourceCode, scriptURL)); | 132 script->evaluate(ScriptSourceCode(sourceCode, scriptURL)); |
| 133 | 133 |
| 134 runEventLoop(); | 134 runEventLoop(); |
| 135 | 135 |
| 136 ThreadIdentifier threadID = m_threadID; | 136 ThreadIdentifier threadID = m_threadID; |
| 137 | 137 |
| 138 // The below assignment will destroy the context, which will in turn notify
messaging proxy. | 138 // The below assignment will destroy the context, which will in turn notify
messaging proxy. |
| 139 // We cannot let any objects survive past thread exit, because no other thre
ad will run GC or otherwise destroy them. | 139 // We cannot let any objects survive past thread exit, because no other thre
ad will run GC or otherwise destroy them. |
| 140 // If Oilpan is enabled, we detach of the context/global scope, with the fin
al heap cleanup below sweeping it out. | 140 // If Oilpan is enabled, we detach of the context/global scope, with the fin
al heap cleanup below sweeping it out. |
| 141 #if ENABLE(OILPAN) | 141 #if ENABLE(OILPAN) |
| 142 m_workerGlobalScope->dispose(); | 142 // The thread object is owned by the main thread. After the call |
| 143 // to dispose, the thread object can therefore be dead and the |
| 144 // Persistent handle for m_workerGlobalScope has been deleted. |
| 145 // Therefore, we clear the m_workerGlobalScope persistent handle |
| 146 // before the call to dispose. |
| 147 WorkerGlobalScope* scope = m_workerGlobalScope; |
| 148 m_workerGlobalScope = nullptr; |
| 149 scope->dispose(); |
| 143 #else | 150 #else |
| 144 ASSERT(m_workerGlobalScope->hasOneRef()); | 151 ASSERT(m_workerGlobalScope->hasOneRef()); |
| 152 m_workerGlobalScope = nullptr; |
| 145 #endif | 153 #endif |
| 146 m_workerGlobalScope = nullptr; | |
| 147 | 154 |
| 148 ThreadState::detach(); | 155 ThreadState::detach(); |
| 149 | 156 |
| 150 // Clean up PlatformThreadData before WTF::WTFThreadData goes away! | 157 // Clean up PlatformThreadData before WTF::WTFThreadData goes away! |
| 151 PlatformThreadData::current().destroy(); | 158 PlatformThreadData::current().destroy(); |
| 152 | 159 |
| 153 // The thread object may be already destroyed from notification now, don't t
ry to access "this". | 160 // The thread object may be already destroyed from notification now, don't t
ry to access "this". |
| 154 detachThread(threadID); | 161 detachThread(threadID); |
| 155 } | 162 } |
| 156 | 163 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads() | 244 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads() |
| 238 { | 245 { |
| 239 MutexLocker lock(threadSetMutex()); | 246 MutexLocker lock(threadSetMutex()); |
| 240 HashSet<WorkerThread*>& threads = workerThreads(); | 247 HashSet<WorkerThread*>& threads = workerThreads(); |
| 241 HashSet<WorkerThread*>::iterator end = threads.end(); | 248 HashSet<WorkerThread*>::iterator end = threads.end(); |
| 242 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) | 249 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) |
| 243 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask))
; | 250 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask))
; |
| 244 } | 251 } |
| 245 | 252 |
| 246 } // namespace WebCore | 253 } // namespace WebCore |
| OLD | NEW |