| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2013 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 void DatabaseThread::setupDatabaseThread() | 77 void DatabaseThread::setupDatabaseThread() |
| 78 { | 78 { |
| 79 m_pendingGCRunner = adoptPtr(new PendingGCRunner); | 79 m_pendingGCRunner = adoptPtr(new PendingGCRunner); |
| 80 m_messageLoopInterruptor = adoptPtr(new MessageLoopInterruptor(m_thread.get(
))); | 80 m_messageLoopInterruptor = adoptPtr(new MessageLoopInterruptor(m_thread.get(
))); |
| 81 m_thread->addTaskObserver(m_pendingGCRunner.get()); | 81 m_thread->addTaskObserver(m_pendingGCRunner.get()); |
| 82 ThreadState::attach(); | 82 ThreadState::attach(); |
| 83 ThreadState::current()->addInterruptor(m_messageLoopInterruptor.get()); | 83 ThreadState::current()->addInterruptor(m_messageLoopInterruptor.get()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void DatabaseThread::requestTermination(TaskSynchronizer *cleanupSync) | 86 void DatabaseThread::requestTermination(DatabaseTaskSynchronizer *cleanupSync) |
| 87 { | 87 { |
| 88 MutexLocker lock(m_terminationRequestedMutex); | 88 MutexLocker lock(m_terminationRequestedMutex); |
| 89 ASSERT(!m_terminationRequested); | 89 ASSERT(!m_terminationRequested); |
| 90 m_terminationRequested = true; | 90 m_terminationRequested = true; |
| 91 m_cleanupSync = cleanupSync; | 91 m_cleanupSync = cleanupSync; |
| 92 WTF_LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); | 92 WTF_LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); |
| 93 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThread
, this))); | 93 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThread
, this))); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool DatabaseThread::terminationRequested(TaskSynchronizer* taskSynchronizer) co
nst | 96 bool DatabaseThread::terminationRequested(DatabaseTaskSynchronizer* taskSynchron
izer) const |
| 97 { | 97 { |
| 98 #ifndef NDEBUG | 98 #ifndef NDEBUG |
| 99 if (taskSynchronizer) | 99 if (taskSynchronizer) |
| 100 taskSynchronizer->setHasCheckedForTermination(); | 100 taskSynchronizer->setHasCheckedForTermination(); |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 MutexLocker lock(m_terminationRequestedMutex); | 103 MutexLocker lock(m_terminationRequestedMutex); |
| 104 return m_terminationRequested; | 104 return m_terminationRequested; |
| 105 } | 105 } |
| 106 | 106 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) | 167 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) |
| 168 { | 168 { |
| 169 ASSERT(m_thread); | 169 ASSERT(m_thread); |
| 170 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); | 170 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); |
| 171 // WebThread takes ownership of the task. | 171 // WebThread takes ownership of the task. |
| 172 m_thread->postTask(task.leakPtr()); | 172 m_thread->postTask(task.leakPtr()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace WebCore | 175 } // namespace WebCore |
| OLD | NEW |