From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../WebCore/Modules/webdatabase/DatabaseThread.h | 56 +++++++--------------- 1 file changed, 18 insertions(+), 38 deletions(-) (limited to 'Source/WebCore/Modules/webdatabase/DatabaseThread.h') diff --git a/Source/WebCore/Modules/webdatabase/DatabaseThread.h b/Source/WebCore/Modules/webdatabase/DatabaseThread.h index c05979e5a..ec041e318 100644 --- a/Source/WebCore/Modules/webdatabase/DatabaseThread.h +++ b/Source/WebCore/Modules/webdatabase/DatabaseThread.h @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -25,82 +25,62 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DatabaseThread_h -#define DatabaseThread_h -#if ENABLE(SQL_DATABASE) +#pragma once -#include -#include +#include #include #include -#include -#include -#include #include #include namespace WebCore { -class DatabaseBackend; +class Database; class DatabaseTask; class DatabaseTaskSynchronizer; class Document; -class SQLTransactionClient; class SQLTransactionCoordinator; class DatabaseThread : public ThreadSafeRefCounted { public: - static PassRefPtr create() { return adoptRef(new DatabaseThread); } + static Ref create() { return adoptRef(*new DatabaseThread); } ~DatabaseThread(); bool start(); void requestTermination(DatabaseTaskSynchronizer* cleanupSync); - bool terminationRequested(DatabaseTaskSynchronizer* taskSynchronizer = 0) const; + bool terminationRequested(DatabaseTaskSynchronizer* = nullptr) const; - void scheduleTask(std::unique_ptr); - void scheduleImmediateTask(std::unique_ptr); // This just adds the task to the front of the queue - the caller needs to be extremely careful not to create deadlocks when waiting for completion. - void unscheduleDatabaseTasks(DatabaseBackend*); + void scheduleTask(std::unique_ptr&&); + void scheduleImmediateTask(std::unique_ptr&&); // This just adds the task to the front of the queue - the caller needs to be extremely careful not to create deadlocks when waiting for completion. + void unscheduleDatabaseTasks(Database&); + bool hasPendingDatabaseActivity() const; - void recordDatabaseOpen(DatabaseBackend*); - void recordDatabaseClosed(DatabaseBackend*); + void recordDatabaseOpen(Database&); + void recordDatabaseClosed(Database&); ThreadIdentifier getThreadID() { return m_threadID; } - SQLTransactionClient* transactionClient() { return m_transactionClient.get(); } SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCoordinator.get(); } -#if PLATFORM(IOS) - void setPaused(bool); - void handlePausedQueue(); -#endif - private: DatabaseThread(); static void databaseThreadStart(void*); void databaseThread(); - Mutex m_threadCreationMutex; - ThreadIdentifier m_threadID; + Lock m_threadCreationMutex; + ThreadIdentifier m_threadID { 0 }; RefPtr m_selfRef; MessageQueue m_queue; -#if PLATFORM(IOS) - MessageQueue m_pausedQueue; - Mutex m_pausedMutex; - volatile bool m_paused; -#endif // This set keeps track of the open databases that have been used on this thread. - typedef HashSet> DatabaseSet; + using DatabaseSet = HashSet>; + mutable Lock m_openDatabaseSetMutex; DatabaseSet m_openDatabaseSet; - OwnPtr m_transactionClient; - OwnPtr m_transactionCoordinator; - DatabaseTaskSynchronizer* m_cleanupSync; + std::unique_ptr m_transactionCoordinator; + DatabaseTaskSynchronizer* m_cleanupSync { nullptr }; }; } // namespace WebCore - -#endif // ENABLE(SQL_DATABASE) -#endif // DatabaseThread_h -- cgit v1.2.1