| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 m_workerContext->script()->forbidExecution(); | 159 m_workerContext->script()->forbidExecution(); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 #if PLATFORM(CHROMIUM) | 162 #if PLATFORM(CHROMIUM) |
| 163 // The corresponding call to didStopWorkerRunLoop is in | 163 // The corresponding call to didStopWorkerRunLoop is in |
| 164 // ~WorkerScriptController. | 164 // ~WorkerScriptController. |
| 165 WebKit::Platform::current()->didStartWorkerRunLoop(WebKit::WebWorkerRunLoop(
&m_runLoop)); | 165 WebKit::Platform::current()->didStartWorkerRunLoop(WebKit::WebWorkerRunLoop(
&m_runLoop)); |
| 166 #endif | 166 #endif |
| 167 | 167 |
| 168 WorkerScriptController* script = m_workerContext->script(); | 168 WorkerScriptController* script = m_workerContext->script(); |
| 169 #if ENABLE(INSPECTOR) | |
| 170 InspectorInstrumentation::willEvaluateWorkerScript(workerContext(), m_startu
pData->m_startMode); | 169 InspectorInstrumentation::willEvaluateWorkerScript(workerContext(), m_startu
pData->m_startMode); |
| 171 #endif | |
| 172 script->evaluate(ScriptSourceCode(m_startupData->m_sourceCode, m_startupData
->m_scriptURL)); | 170 script->evaluate(ScriptSourceCode(m_startupData->m_sourceCode, m_startupData
->m_scriptURL)); |
| 173 // Free the startup data to cause its member variable deref's happen on the
worker's thread (since | 171 // Free the startup data to cause its member variable deref's happen on the
worker's thread (since |
| 174 // all ref/derefs of these objects are happening on the thread at this point
). Note that | 172 // all ref/derefs of these objects are happening on the thread at this point
). Note that |
| 175 // WorkerThread::~WorkerThread happens on a different thread where it was cr
eated. | 173 // WorkerThread::~WorkerThread happens on a different thread where it was cr
eated. |
| 176 m_startupData.clear(); | 174 m_startupData.clear(); |
| 177 | 175 |
| 178 runEventLoop(); | 176 runEventLoop(); |
| 179 | 177 |
| 180 ThreadIdentifier threadID = m_threadID; | 178 ThreadIdentifier threadID = m_threadID; |
| 181 | 179 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 202 public: | 200 public: |
| 203 static PassOwnPtr<WorkerThreadShutdownFinishTask> create() | 201 static PassOwnPtr<WorkerThreadShutdownFinishTask> create() |
| 204 { | 202 { |
| 205 return adoptPtr(new WorkerThreadShutdownFinishTask()); | 203 return adoptPtr(new WorkerThreadShutdownFinishTask()); |
| 206 } | 204 } |
| 207 | 205 |
| 208 virtual void performTask(ScriptExecutionContext *context) | 206 virtual void performTask(ScriptExecutionContext *context) |
| 209 { | 207 { |
| 210 ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext()); | 208 ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext()); |
| 211 WorkerContext* workerContext = static_cast<WorkerContext*>(context); | 209 WorkerContext* workerContext = static_cast<WorkerContext*>(context); |
| 212 #if ENABLE(INSPECTOR) | |
| 213 workerContext->clearInspector(); | 210 workerContext->clearInspector(); |
| 214 #endif | |
| 215 // It's not safe to call clearScript until all the cleanup tasks posted
by functions initiated by WorkerThreadShutdownStartTask have completed. | 211 // It's not safe to call clearScript until all the cleanup tasks posted
by functions initiated by WorkerThreadShutdownStartTask have completed. |
| 216 workerContext->clearScript(); | 212 workerContext->clearScript(); |
| 217 } | 213 } |
| 218 | 214 |
| 219 virtual bool isCleanupTask() const { return true; } | 215 virtual bool isCleanupTask() const { return true; } |
| 220 }; | 216 }; |
| 221 | 217 |
| 222 class WorkerThreadShutdownStartTask : public ScriptExecutionContext::Task { | 218 class WorkerThreadShutdownStartTask : public ScriptExecutionContext::Task { |
| 223 public: | 219 public: |
| 224 static PassOwnPtr<WorkerThreadShutdownStartTask> create() | 220 static PassOwnPtr<WorkerThreadShutdownStartTask> create() |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 MutexLocker lock(threadSetMutex()); | 282 MutexLocker lock(threadSetMutex()); |
| 287 HashSet<WorkerThread*>& threads = workerThreads(); | 283 HashSet<WorkerThread*>& threads = workerThreads(); |
| 288 HashSet<WorkerThread*>::iterator end = threads.end(); | 284 HashSet<WorkerThread*>::iterator end = threads.end(); |
| 289 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) | 285 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) |
| 290 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask))
; | 286 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask))
; |
| 291 } | 287 } |
| 292 | 288 |
| 293 } // namespace WebCore | 289 } // namespace WebCore |
| 294 | 290 |
| 295 #endif // ENABLE(WORKERS) | 291 #endif // ENABLE(WORKERS) |
| OLD | NEW |