Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 | 28 |
| 29 #include "core/workers/WorkerThread.h" | 29 #include "core/workers/WorkerThread.h" |
| 30 | 30 |
| 31 #include "bindings/v8/ScriptSourceCode.h" | 31 #include "bindings/v8/ScriptSourceCode.h" |
| 32 #include "core/dom/Microtask.h" | |
| 32 #include "core/inspector/InspectorInstrumentation.h" | 33 #include "core/inspector/InspectorInstrumentation.h" |
| 33 #include "core/workers/DedicatedWorkerGlobalScope.h" | 34 #include "core/workers/DedicatedWorkerGlobalScope.h" |
| 34 #include "core/workers/WorkerClients.h" | 35 #include "core/workers/WorkerClients.h" |
| 35 #include "core/workers/WorkerReportingProxy.h" | 36 #include "core/workers/WorkerReportingProxy.h" |
| 36 #include "core/workers/WorkerThreadStartupData.h" | 37 #include "core/workers/WorkerThreadStartupData.h" |
| 37 #include "heap/ThreadState.h" | 38 #include "heap/ThreadState.h" |
| 38 #include "platform/PlatformThreadData.h" | 39 #include "platform/PlatformThreadData.h" |
| 39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 40 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 41 #include "public/platform/WebWaitableEvent.h" | 42 #include "public/platform/WebWaitableEvent.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 { | 107 { |
| 107 KURL scriptURL = m_startupData->m_scriptURL; | 108 KURL scriptURL = m_startupData->m_scriptURL; |
| 108 String sourceCode = m_startupData->m_sourceCode; | 109 String sourceCode = m_startupData->m_sourceCode; |
| 109 WorkerThreadStartMode startMode = m_startupData->m_startMode; | 110 WorkerThreadStartMode startMode = m_startupData->m_startMode; |
| 110 | 111 |
| 111 { | 112 { |
| 112 MutexLocker lock(m_threadCreationMutex); | 113 MutexLocker lock(m_threadCreationMutex); |
| 113 ThreadState::attach(); | 114 ThreadState::attach(); |
| 114 m_workerGlobalScope = createWorkerGlobalScope(m_startupData.release()); | 115 m_workerGlobalScope = createWorkerGlobalScope(m_startupData.release()); |
| 115 m_runLoop.setWorkerGlobalScope(workerGlobalScope()); | 116 m_runLoop.setWorkerGlobalScope(workerGlobalScope()); |
| 117 // Call performCheckpoint now to call ensureDomInJSContext. | |
| 118 Microtask::performCheckpoint(); | |
|
adamk
2014/03/28 17:55:05
I don't understand why this is here.
| |
| 116 | 119 |
| 117 if (m_runLoop.terminated()) { | 120 if (m_runLoop.terminated()) { |
| 118 // The worker was terminated before the thread had a chance to run. Since the context didn't exist yet, | 121 // The worker was terminated before the thread had a chance to run. Since the context didn't exist yet, |
| 119 // forbidExecution() couldn't be called from stop(). | 122 // forbidExecution() couldn't be called from stop(). |
| 120 m_workerGlobalScope->script()->forbidExecution(); | 123 m_workerGlobalScope->script()->forbidExecution(); |
| 121 } | 124 } |
| 122 } | 125 } |
| 123 // The corresponding call to didStopWorkerRunLoop is in | 126 // The corresponding call to didStopWorkerRunLoop is in |
| 124 // ~WorkerScriptController. | 127 // ~WorkerScriptController. |
| 125 blink::Platform::current()->didStartWorkerRunLoop(blink::WebWorkerRunLoop(&m _runLoop)); | 128 blink::Platform::current()->didStartWorkerRunLoop(blink::WebWorkerRunLoop(&m _runLoop)); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads() | 252 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads() |
| 250 { | 253 { |
| 251 MutexLocker lock(threadSetMutex()); | 254 MutexLocker lock(threadSetMutex()); |
| 252 HashSet<WorkerThread*>& threads = workerThreads(); | 255 HashSet<WorkerThread*>& threads = workerThreads(); |
| 253 HashSet<WorkerThread*>::iterator end = threads.end(); | 256 HashSet<WorkerThread*>::iterator end = threads.end(); |
| 254 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) | 257 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) |
| 255 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask)) ; | 258 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask)) ; |
| 256 } | 259 } |
| 257 | 260 |
| 258 } // namespace WebCore | 261 } // namespace WebCore |
| OLD | NEW |