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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get()); | 130 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get()); |
131 | 131 |
132 WorkerScriptController* script = m_workerGlobalScope->script(); | 132 WorkerScriptController* script = m_workerGlobalScope->script(); |
133 InspectorInstrumentation::willEvaluateWorkerScript(workerGlobalScope(), star
tMode); | 133 InspectorInstrumentation::willEvaluateWorkerScript(workerGlobalScope(), star
tMode); |
134 script->evaluate(ScriptSourceCode(sourceCode, scriptURL)); | 134 script->evaluate(ScriptSourceCode(sourceCode, scriptURL)); |
135 | 135 |
136 runEventLoop(); | 136 runEventLoop(); |
137 | 137 |
138 ThreadIdentifier threadID = m_threadID; | 138 ThreadIdentifier threadID = m_threadID; |
139 | 139 |
140 #if !ENABLE_OILPAN | 140 // The below assignment will destroy the context, which will in turn notify
messaging proxy. |
| 141 // We cannot let any objects survive past thread exit, because no other thre
ad will run GC or otherwise destroy them. |
| 142 // If Oilpan is enabled, we detach of the context/global scope, with the fin
al heap cleanup below sweeping it out. |
| 143 #if ENABLE(OILPAN) |
| 144 m_workerGlobalScope->dispose(); |
| 145 #else |
141 ASSERT(m_workerGlobalScope->hasOneRef()); | 146 ASSERT(m_workerGlobalScope->hasOneRef()); |
142 #endif | 147 #endif |
143 | |
144 // The below assignment will destroy the context, which will in turn notify
messaging proxy. | |
145 // We cannot let any objects survive past thread exit, because no other thre
ad will run GC or otherwise destroy them. | |
146 m_workerGlobalScope = nullptr; | 148 m_workerGlobalScope = nullptr; |
147 | 149 |
148 ThreadState::detach(); | 150 ThreadState::detach(); |
149 | 151 |
150 // Clean up PlatformThreadData before WTF::WTFThreadData goes away! | 152 // Clean up PlatformThreadData before WTF::WTFThreadData goes away! |
151 PlatformThreadData::current().destroy(); | 153 PlatformThreadData::current().destroy(); |
152 | 154 |
153 // The thread object may be already destroyed from notification now, don't t
ry to access "this". | 155 // The thread object may be already destroyed from notification now, don't t
ry to access "this". |
154 detachThread(threadID); | 156 detachThread(threadID); |
155 } | 157 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads() | 248 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads() |
247 { | 249 { |
248 MutexLocker lock(threadSetMutex()); | 250 MutexLocker lock(threadSetMutex()); |
249 HashSet<WorkerThread*>& threads = workerThreads(); | 251 HashSet<WorkerThread*>& threads = workerThreads(); |
250 HashSet<WorkerThread*>::iterator end = threads.end(); | 252 HashSet<WorkerThread*>::iterator end = threads.end(); |
251 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) | 253 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) |
252 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask))
; | 254 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask))
; |
253 } | 255 } |
254 | 256 |
255 } // namespace WebCore | 257 } // namespace WebCore |
OLD | NEW |