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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 // Mutex protection is necessary because stop() can be called before the con text is fully created. | 221 // Mutex protection is necessary because stop() can be called before the con text is fully created. |
| 222 MutexLocker lock(m_threadCreationMutex); | 222 MutexLocker lock(m_threadCreationMutex); |
| 223 | 223 |
| 224 // Signal the thread to notify that the thread's stopping. | 224 // Signal the thread to notify that the thread's stopping. |
| 225 if (m_shutdownEvent) | 225 if (m_shutdownEvent) |
| 226 m_shutdownEvent->signal(); | 226 m_shutdownEvent->signal(); |
| 227 | 227 |
| 228 // Ensure that tasks are being handled by thread event loop. If script execu tion weren't forbidden, a while(1) loop in JS could keep the thread alive foreve r. | 228 // Ensure that tasks are being handled by thread event loop. If script execu tion weren't forbidden, a while(1) loop in JS could keep the thread alive foreve r. |
| 229 if (m_workerGlobalScope) { | 229 if (m_workerGlobalScope) { |
| 230 m_workerGlobalScope->script()->scheduleExecutionTermination(); | 230 m_workerGlobalScope->script()->scheduleExecutionTermination(); |
| 231 | |
| 232 DatabaseManager::manager().interruptAllDatabasesForContext(m_workerGloba lScope.get()); | |
|
adamk
2014/02/27 17:28:26
I've been curious for awhile about why this line w
jochen (gone - plz use gerrit)
2014/02/27 19:40:55
There might be SQLTransaction steps in the message
| |
| 233 m_runLoop.postTaskAndTerminate(WorkerThreadShutdownStartTask::create()); | 231 m_runLoop.postTaskAndTerminate(WorkerThreadShutdownStartTask::create()); |
| 234 return; | 232 return; |
| 235 } | 233 } |
| 236 m_runLoop.terminate(); | 234 m_runLoop.terminate(); |
| 237 } | 235 } |
| 238 | 236 |
| 239 bool WorkerThread::isCurrentThread() const | 237 bool WorkerThread::isCurrentThread() const |
| 240 { | 238 { |
| 241 return m_threadID == currentThread(); | 239 return m_threadID == currentThread(); |
| 242 } | 240 } |
| 243 | 241 |
| 244 class ReleaseFastMallocFreeMemoryTask : public ExecutionContextTask { | 242 class ReleaseFastMallocFreeMemoryTask : public ExecutionContextTask { |
| 245 virtual void performTask(ExecutionContext*) OVERRIDE { WTF::releaseFastMallo cFreeMemory(); } | 243 virtual void performTask(ExecutionContext*) OVERRIDE { WTF::releaseFastMallo cFreeMemory(); } |
| 246 }; | 244 }; |
| 247 | 245 |
| 248 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads() | 246 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads() |
| 249 { | 247 { |
| 250 MutexLocker lock(threadSetMutex()); | 248 MutexLocker lock(threadSetMutex()); |
| 251 HashSet<WorkerThread*>& threads = workerThreads(); | 249 HashSet<WorkerThread*>& threads = workerThreads(); |
| 252 HashSet<WorkerThread*>::iterator end = threads.end(); | 250 HashSet<WorkerThread*>::iterator end = threads.end(); |
| 253 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) | 251 for (HashSet<WorkerThread*>::iterator it = threads.begin(); it != end; ++it) |
| 254 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask)) ; | 252 (*it)->runLoop().postTask(adoptPtr(new ReleaseFastMallocFreeMemoryTask)) ; |
| 255 } | 253 } |
| 256 | 254 |
| 257 } // namespace WebCore | 255 } // namespace WebCore |
| OLD | NEW |