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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 void DatabaseThread::setupDatabaseThread() | 71 void DatabaseThread::setupDatabaseThread() |
72 { | 72 { |
73 m_pendingGCRunner = adoptPtr(new PendingGCRunner); | 73 m_pendingGCRunner = adoptPtr(new PendingGCRunner); |
74 m_messageLoopInterruptor = adoptPtr(new MessageLoopInterruptor(m_thread.get(
))); | 74 m_messageLoopInterruptor = adoptPtr(new MessageLoopInterruptor(m_thread.get(
))); |
75 m_thread->addTaskObserver(m_pendingGCRunner.get()); | 75 m_thread->addTaskObserver(m_pendingGCRunner.get()); |
76 ThreadState::attach(); | 76 ThreadState::attach(); |
77 ThreadState::current()->addInterruptor(m_messageLoopInterruptor.get()); | 77 ThreadState::current()->addInterruptor(m_messageLoopInterruptor.get()); |
78 } | 78 } |
79 | 79 |
80 void DatabaseThread::requestTermination(DatabaseTaskSynchronizer *cleanupSync) | 80 void DatabaseThread::requestTermination(TaskSynchronizer *cleanupSync) |
81 { | 81 { |
82 MutexLocker lock(m_terminationRequestedMutex); | 82 MutexLocker lock(m_terminationRequestedMutex); |
83 ASSERT(!m_terminationRequested); | 83 ASSERT(!m_terminationRequested); |
84 m_terminationRequested = true; | 84 m_terminationRequested = true; |
85 m_cleanupSync = cleanupSync; | 85 m_cleanupSync = cleanupSync; |
86 WTF_LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); | 86 WTF_LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); |
87 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThread
, this))); | 87 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThread
, this))); |
88 } | 88 } |
89 | 89 |
90 bool DatabaseThread::terminationRequested(DatabaseTaskSynchronizer* taskSynchron
izer) const | 90 bool DatabaseThread::terminationRequested(TaskSynchronizer* taskSynchronizer) co
nst |
91 { | 91 { |
92 #ifndef NDEBUG | 92 #ifndef NDEBUG |
93 if (taskSynchronizer) | 93 if (taskSynchronizer) |
94 taskSynchronizer->setHasCheckedForTermination(); | 94 taskSynchronizer->setHasCheckedForTermination(); |
95 #endif | 95 #endif |
96 | 96 |
97 MutexLocker lock(m_terminationRequestedMutex); | 97 MutexLocker lock(m_terminationRequestedMutex); |
98 return m_terminationRequested; | 98 return m_terminationRequested; |
99 } | 99 } |
100 | 100 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) | 161 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) |
162 { | 162 { |
163 ASSERT(m_thread); | 163 ASSERT(m_thread); |
164 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); | 164 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); |
165 // WebThread takes ownership of the task. | 165 // WebThread takes ownership of the task. |
166 m_thread->postTask(task.leakPtr()); | 166 m_thread->postTask(task.leakPtr()); |
167 } | 167 } |
168 | 168 |
169 } // namespace WebCore | 169 } // namespace WebCore |
OLD | NEW |