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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(TaskSynchronizer* taskSynchronizer) co
nst |
97 { | 97 { |
98 #ifndef NDEBUG | 98 #if ENABLE(ASSERT) |
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 |
107 void DatabaseThread::cleanupDatabaseThread() | 107 void DatabaseThread::cleanupDatabaseThread() |
108 { | 108 { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) | 164 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) |
165 { | 165 { |
166 ASSERT(m_thread); | 166 ASSERT(m_thread); |
167 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); | 167 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); |
168 // WebThread takes ownership of the task. | 168 // WebThread takes ownership of the task. |
169 m_thread->postTask(task.leakPtr()); | 169 m_thread->postTask(task.leakPtr()); |
170 } | 170 } |
171 | 171 |
172 } // namespace WebCore | 172 } // namespace WebCore |
OLD | NEW |