diff options
author | Steve Block <steveblock@google.com> | 2010-02-02 14:57:50 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-04 15:06:55 +0000 |
commit | d0825bca7fe65beaee391d30da42e937db621564 (patch) | |
tree | 7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/storage/DatabaseThread.cpp | |
parent | 3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff) | |
download | external_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2 |
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/storage/DatabaseThread.cpp')
-rw-r--r-- | WebCore/storage/DatabaseThread.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/WebCore/storage/DatabaseThread.cpp b/WebCore/storage/DatabaseThread.cpp index 12e9251..ec4c6d1 100644 --- a/WebCore/storage/DatabaseThread.cpp +++ b/WebCore/storage/DatabaseThread.cpp @@ -44,6 +44,7 @@ DatabaseThread::DatabaseThread() : m_threadID(0) , m_transactionClient(new SQLTransactionClient()) , m_transactionCoordinator(new SQLTransactionCoordinator()) + , m_cleanupSync(0) { m_selfRef = this; } @@ -51,6 +52,7 @@ DatabaseThread::DatabaseThread() DatabaseThread::~DatabaseThread() { // FIXME: Any cleanup required here? Since the thread deletes itself after running its detached course, I don't think so. Lets be sure. + ASSERT(terminationRequested()); } bool DatabaseThread::start() @@ -65,8 +67,10 @@ bool DatabaseThread::start() return m_threadID; } -void DatabaseThread::requestTermination() +void DatabaseThread::requestTermination(DatabaseTaskSynchronizer *cleanupSync) { + ASSERT(!m_cleanupSync); + m_cleanupSync = cleanupSync; LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); m_queue.kill(); } @@ -115,9 +119,14 @@ void* DatabaseThread::databaseThread() // Detach the thread so its resources are no longer of any concern to anyone else detachThread(m_threadID); + DatabaseTaskSynchronizer* cleanupSync = m_cleanupSync; + // Clear the self refptr, possibly resulting in deletion m_selfRef = 0; + if (cleanupSync) // Someone wanted to know when we were done cleaning up. + cleanupSync->taskCompleted(); + return 0; } @@ -162,6 +171,5 @@ void DatabaseThread::unscheduleDatabaseTasks(Database* database) SameDatabasePredicate predicate(database); m_queue.removeIf(predicate); } - } // namespace WebCore #endif |