Changeset 219298 in webkit
- Timestamp:
- Jul 10, 2017 10:43:38 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r219281 r219298 1 2017-07-10 Brady Eidson <beidson@apple.com> 2 3 Cleanup lifetime issues of UniqueIDBDatabase and IDBBackingStore. 4 <rdar://problem/32908525> and https://bugs.webkit.org/show_bug.cgi?id=174244 5 6 Reviewed by David Kilzer and Alex Christensen. 7 8 Add proper "kill" support to CrossThreadQueue, as well as isEmpty() support. 9 10 * wtf/CrossThreadQueue.h: 11 (WTF::CrossThreadQueue<DataType>::append): 12 (WTF::CrossThreadQueue<DataType>::kill): 13 (WTF::CrossThreadQueue<DataType>::isKilled): 14 (WTF::CrossThreadQueue<DataType>::isEmpty): 15 (WTF::CrossThreadQueue::isKilled): Deleted. 16 1 17 2017-07-09 Yusuke Suzuki <utatane.tea@gmail.com> 2 18 -
trunk/Source/WTF/wtf/CrossThreadQueue.h
r218594 r219298 47 47 std::optional<DataType> tryGetMessage(); 48 48 49 bool isKilled() const { return false; } 49 void kill(); 50 bool isKilled() const; 51 bool isEmpty() const; 50 52 51 53 private: … … 53 55 Condition m_condition; 54 56 Deque<DataType> m_queue; 57 bool m_killed { false }; 55 58 }; 56 59 … … 59 62 { 60 63 LockHolder lock(m_lock); 64 ASSERT(!m_killed); 61 65 m_queue.append(WTFMove(message)); 62 66 m_condition.notifyOne(); … … 91 95 } 92 96 97 template<typename DataType> 98 void CrossThreadQueue<DataType>::kill() 99 { 100 LockHolder lock(m_lock); 101 m_killed = true; 102 m_condition.notifyAll(); 103 } 104 105 template<typename DataType> 106 bool CrossThreadQueue<DataType>::isKilled() const 107 { 108 LockHolder lock(m_lock); 109 return m_killed; 110 } 111 112 template<typename DataType> 113 bool CrossThreadQueue<DataType>::isEmpty() const 114 { 115 LockHolder lock(m_lock); 116 return m_queue.isEmpty(); 117 } 118 93 119 } // namespace WTF 94 120 -
trunk/Source/WebCore/ChangeLog
r219297 r219298 1 2017-07-10 Brady Eidson <beidson@apple.com> 2 3 Cleanup lifetime issues of UniqueIDBDatabase and IDBBackingStore. 4 <rdar://problem/32908525> and https://bugs.webkit.org/show_bug.cgi?id=174244 5 6 Reviewed by David Kilzer and Alex Christensen. 7 8 No targeted test possible, implicitly covered by all IDB tests. 9 10 The original idea behind UniqueIDBDatabase lifetime was that they are ThreadSafeRefCounted and 11 we take protector Refs when any operation that needs it alive is in flight. 12 13 This added variability to their lifetime which made it difficult to enforce a few different 14 design invariants, namely: 15 - UniqueIBDDatabase objects are always created and destroyed only on the main thread. 16 - IDBBackingStore objects are always created and destroyed only on the database thread. 17 18 This patch removes the ref counting and instead ties UniqueIDBDatabase lifetime to a 19 std::unique_ptr that is owned by the IDBServer. 20 21 Whenever any operations on the UniqueIDBDatabase are in flight it is kept alive by virtue 22 of that unique_ptr in the IDBServer. Once a UniqueIDBDatabase is completely done with all of 23 its work, the following happens: 24 - On the main thread the IDBServer removes the unique_ptr owning the UniqueIDBDatabase 25 from its map. 26 - It hands the unique_ptr to the UniqueIDBDatabase itself, which schedules one final 27 database thread task. 28 - That database thread task is to destroy the IDBBackingStore, kill its message queues, 29 and then message back to the main thread for one final task. 30 - That main thread task is to release the unique_ptr, resulting in destruction of the 31 UniqueIDBDatabase object. 32 33 This is safe, predictable, solves the lifetime issues that r218516 originally tried to solve, 34 and solves the lifetime issues that r218516 introduced. 35 36 (This patch also adds many more assertions to cover various design invariants throughout the 37 lifecycle of a particular UniqueIDBDatabase) 38 39 ASSERT that IDBBackingStores are only ever created and destroyed on the background thread: 40 * Modules/indexeddb/server/IDBBackingStore.h: 41 (WebCore::IDBServer::IDBBackingStore::~IDBBackingStore): 42 (WebCore::IDBServer::IDBBackingStore::IDBBackingStore): 43 44 Transition UniqueIDBDatabase ownership from a RefPtr to a std::unique_ptr: 45 * Modules/indexeddb/server/IDBServer.cpp: 46 (WebCore::IDBServer::IDBServer::getOrCreateUniqueIDBDatabase): 47 (WebCore::IDBServer::IDBServer::closeAndTakeUniqueIDBDatabase): 48 (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince): 49 (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins): 50 (WebCore::IDBServer::IDBServer::closeUniqueIDBDatabase): Deleted. 51 * Modules/indexeddb/server/IDBServer.h: 52 53 Make all the other changes mentioned above: 54 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 55 (WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase): Bulk up on ASSERTs 56 (WebCore::IDBServer::UniqueIDBDatabase::openDatabaseConnection): 57 (WebCore::IDBServer::UniqueIDBDatabase::performUnconditionalDeleteBackingStore): 58 (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose): 59 (WebCore::IDBServer::UniqueIDBDatabase::shutdownForClose): 60 (WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose): 61 (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore): 62 (WebCore::IDBServer::UniqueIDBDatabase::handleCurrentOperation): 63 (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor): 64 (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor): 65 (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired): 66 (WebCore::IDBServer::UniqueIDBDatabase::activateTransactionInBackingStore): 67 (WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted): 68 (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask): 69 (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply): 70 (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTask): 71 (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply): 72 (WebCore::IDBServer::UniqueIDBDatabase::maybeFinishHardClose): 73 (WebCore::IDBServer::UniqueIDBDatabase::isDoneWithHardClose): 74 (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): 75 (WebCore::IDBServer::UniqueIDBDatabase::didPerformUnconditionalDeleteBackingStore): Deleted. 76 * Modules/indexeddb/server/UniqueIDBDatabase.h: 77 (WebCore::IDBServer::UniqueIDBDatabase::create): Deleted. 78 1 79 2017-07-10 Chris Dumez <cdumez@apple.com> 2 80 -
trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
r209977 r219298 30 30 #include "IDBDatabaseInfo.h" 31 31 #include "IDBError.h" 32 #include <wtf/MainThread.h> 32 33 33 34 namespace WebCore { … … 65 66 class IDBBackingStore { 66 67 public: 67 virtual ~IDBBackingStore() { }68 virtual ~IDBBackingStore() { RELEASE_ASSERT(!isMainThread()); } 68 69 69 70 virtual IDBError getOrEstablishDatabaseInfo(IDBDatabaseInfo&) = 0; … … 99 100 virtual bool supportsSimultaneousTransactions() = 0; 100 101 virtual bool isEphemeral() = 0; 102 103 protected: 104 IDBBackingStore() { RELEASE_ASSERT(!isMainThread()); } 101 105 }; 102 106 -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
r218816 r219298 122 122 auto uniqueIDBDatabase = m_uniqueIDBDatabaseMap.add(identifier, nullptr); 123 123 if (uniqueIDBDatabase.isNewEntry) 124 uniqueIDBDatabase.iterator->value = UniqueIDBDatabase::create(*this, identifier);124 uniqueIDBDatabase.iterator->value = std::make_unique<UniqueIDBDatabase>(*this, identifier); 125 125 126 126 return *uniqueIDBDatabase.iterator->value; … … 172 172 } 173 173 174 void IDBServer::closeUniqueIDBDatabase(UniqueIDBDatabase& database)174 std::unique_ptr<UniqueIDBDatabase> IDBServer::closeAndTakeUniqueIDBDatabase(UniqueIDBDatabase& database) 175 175 { 176 176 LOG(IndexedDB, "IDBServer::closeUniqueIDBDatabase"); 177 177 ASSERT(isMainThread()); 178 178 179 m_uniqueIDBDatabaseMap.remove(database.identifier()); 179 auto uniquePointer = m_uniqueIDBDatabaseMap.take(database.identifier()); 180 ASSERT(uniquePointer); 181 182 return uniquePointer; 180 183 } 181 184 … … 546 549 } 547 550 548 HashSet< RefPtr<UniqueIDBDatabase>> openDatabases;551 HashSet<UniqueIDBDatabase*> openDatabases; 549 552 for (auto* connection : m_databaseConnections.values()) 550 553 openDatabases.add(&connection->database()); … … 562 565 ASSERT_UNUSED(addResult, addResult.isNewEntry); 563 566 564 HashSet< RefPtr<UniqueIDBDatabase>> openDatabases;567 HashSet<UniqueIDBDatabase*> openDatabases; 565 568 for (auto* connection : m_databaseConnections.values()) { 566 569 const auto& identifier = connection->database().identifier(); -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h
r218816 r219298 99 99 void unregisterTransaction(UniqueIDBDatabaseTransaction&); 100 100 101 void closeUniqueIDBDatabase(UniqueIDBDatabase&);101 std::unique_ptr<UniqueIDBDatabase> closeAndTakeUniqueIDBDatabase(UniqueIDBDatabase&); 102 102 103 103 std::unique_ptr<IDBBackingStore> createBackingStore(const IDBDatabaseIdentifier&); … … 123 123 124 124 HashMap<uint64_t, RefPtr<IDBConnectionToClient>> m_connectionMap; 125 HashMap<IDBDatabaseIdentifier, RefPtr<UniqueIDBDatabase>> m_uniqueIDBDatabaseMap;125 HashMap<IDBDatabaseIdentifier, std::unique_ptr<UniqueIDBDatabase>> m_uniqueIDBDatabaseMap; 126 126 127 127 RefPtr<Thread> m_thread { nullptr }; -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r219204 r219298 74 74 ASSERT(m_clientClosePendingDatabaseConnections.isEmpty()); 75 75 ASSERT(m_serverClosePendingDatabaseConnections.isEmpty()); 76 ASSERT(!m_queuedTaskCount); 76 77 RELEASE_ASSERT(m_databaseQueue.isKilled()); 78 RELEASE_ASSERT(m_databaseReplyQueue.isKilled()); 79 RELEASE_ASSERT(!m_backingStore); 77 80 } 78 81 … … 87 90 LOG(IndexedDB, "UniqueIDBDatabase::openDatabaseConnection"); 88 91 ASSERT(!m_hardClosedForUserDelete); 92 ASSERT(isMainThread()); 89 93 90 94 m_pendingOpenDBRequests.add(ServerOpenDBRequest::create(connection, requestData)); … … 261 265 LOG(IndexedDB, "(db) UniqueIDBDatabase::performUnconditionalDeleteBackingStore"); 262 266 263 if (!m_backingStore) 264 return; 265 266 m_backingStore->deleteBackingStore(); 267 if (m_backingStore) 268 m_backingStore->deleteBackingStore(); 269 270 shutdownForClose(); 271 } 272 273 void UniqueIDBDatabase::scheduleShutdownForClose() 274 { 275 ASSERT(isMainThread()); 276 277 m_owningPointerForClose = m_server.closeAndTakeUniqueIDBDatabase(*this); 278 postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::shutdownForClose)); 279 } 280 281 void UniqueIDBDatabase::shutdownForClose() 282 { 283 ASSERT(!isMainThread()); 284 ASSERT(m_owningPointerForClose.get() == this); 285 286 LOG(IndexedDB, "(db) UniqueIDBDatabase::shutdownForClose"); 287 267 288 m_backingStore = nullptr; 268 289 m_backingStoreSupportsSimultaneousTransactions = false; 269 290 m_backingStoreIsEphemeral = false; 291 292 ASSERT(m_databaseQueue.isEmpty()); 293 m_databaseQueue.kill(); 294 295 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didShutdownForClose)); 296 } 297 298 void UniqueIDBDatabase::didShutdownForClose() 299 { 300 ASSERT(m_databaseReplyQueue.isEmpty()); 301 m_databaseReplyQueue.kill(); 270 302 } 271 303 … … 279 311 ASSERT(m_pendingTransactions.isEmpty()); 280 312 ASSERT(m_openDatabaseConnections.isEmpty()); 313 ASSERT(!m_backingStore); 281 314 282 315 // It's possible that the openDBRequest was cancelled from client-side after the delete was already dispatched to the backingstore. … … 301 334 302 335 if (m_clientClosePendingDatabaseConnections.isEmpty() && m_pendingOpenDBRequests.isEmpty()) { 303 m_server.closeUniqueIDBDatabase(*this); 336 // This UniqueIDBDatabase is now ready to be deleted. 337 ASSERT(m_databaseQueue.isEmpty()); 338 ASSERT(m_databaseReplyQueue.isEmpty()); 339 m_databaseQueue.kill(); 340 m_databaseReplyQueue.kill(); 341 callOnMainThread([owningRef = m_server.closeAndTakeUniqueIDBDatabase(*this)]{ }); 304 342 return; 305 343 } 306 344 307 345 invokeOperationAndTransactionTimer(); 308 }309 310 void UniqueIDBDatabase::didPerformUnconditionalDeleteBackingStore()311 {312 // This function is a placeholder so the database thread can message back to the main thread.313 ASSERT(m_hardClosedForUserDelete);314 346 } 315 347 … … 349 381 ASSERT(!m_hardClosedForUserDelete); 350 382 ASSERT(m_currentOpenDBRequest); 351 352 RefPtr<UniqueIDBDatabase> protectedThis(this);353 383 354 384 if (m_currentOpenDBRequest->isOpenRequest()) … … 1236 1266 1237 1267 if (error.isNull()) { 1238 auto addResult = m_prefetchProtectors.add(cursorIdentifier, nullptr); 1239 if (addResult.isNewEntry) { 1240 addResult.iterator->value = this; 1268 auto addResult = m_cursorPrefetches.add(cursorIdentifier); 1269 if (addResult.isNewEntry) 1241 1270 postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performPrefetchCursor, transactionIdentifier, cursorIdentifier)); 1242 }1243 1271 } 1244 1272 … … 1249 1277 { 1250 1278 ASSERT(!isMainThread()); 1251 ASSERT(m_ prefetchProtectors.contains(cursorIdentifier));1279 ASSERT(m_cursorPrefetches.contains(cursorIdentifier)); 1252 1280 LOG(IndexedDB, "(db) UniqueIDBDatabase::performPrefetchCursor"); 1253 1281 … … 1255 1283 postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performPrefetchCursor, transactionIdentifier, cursorIdentifier)); 1256 1284 else 1257 postDatabaseTaskReply(WTF::Function<void ()>([prefetchProtector = m_prefetchProtectors.take(cursorIdentifier)]() { }));1285 m_cursorPrefetches.remove(cursorIdentifier); 1258 1286 } 1259 1287 … … 1524 1552 LOG(IndexedDB, "(main) UniqueIDBDatabase::operationAndTransactionTimerFired"); 1525 1553 ASSERT(!m_hardClosedForUserDelete); 1526 1527 RefPtr<UniqueIDBDatabase> protectedThis(this); 1554 ASSERT(isMainThread()); 1528 1555 1529 1556 // This UniqueIDBDatabase might be no longer in use by any web page. … … 1532 1559 ASSERT(m_pendingTransactions.isEmpty()); 1533 1560 ASSERT(!hasUnfinishedTransactions()); 1534 m_server.closeUniqueIDBDatabase(*this); 1561 1562 scheduleShutdownForClose(); 1535 1563 return; 1536 1564 } … … 1568 1596 { 1569 1597 LOG(IndexedDB, "(main) UniqueIDBDatabase::activateTransactionInBackingStore"); 1570 1571 RefPtr<UniqueIDBDatabase> protectedThis(this); 1598 ASSERT(isMainThread()); 1599 1572 1600 RefPtr<UniqueIDBDatabaseTransaction> refTransaction(&transaction); 1573 1601 1574 ErrorCallback callback = [ protectedThis,refTransaction](const IDBError& error) {1602 ErrorCallback callback = [refTransaction](const IDBError& error) { 1575 1603 refTransaction->didActivateInBackingStore(error); 1576 1604 }; … … 1677 1705 ASSERT(!m_inProgressTransactions.contains(transaction->info().identifier())); 1678 1706 ASSERT(!m_finishingTransactions.contains(transaction->info().identifier())); 1707 ASSERT(isMainThread()); 1679 1708 1680 1709 for (auto objectStore : transaction->objectStoreIdentifiers()) { … … 1695 1724 // If this transaction completing was the last of those operations, we can finally delete this UniqueIDBDatabase. 1696 1725 if (m_clientClosePendingDatabaseConnections.isEmpty() && m_pendingOpenDBRequests.isEmpty() && !m_databaseInfo) { 1697 m_server.closeUniqueIDBDatabase(*this);1726 scheduleShutdownForClose(); 1698 1727 return; 1699 1728 } … … 1708 1737 void UniqueIDBDatabase::postDatabaseTask(CrossThreadTask&& task) 1709 1738 { 1710 m_databaseQueue.append([protectedThis = makeRef(*this), task = WTFMove(task)]() mutable { 1711 task.performTask(); 1712 }); 1713 ++m_queuedTaskCount; 1714 1739 m_databaseQueue.append(WTFMove(task)); 1715 1740 m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTask)); 1716 1741 } … … 1720 1745 ASSERT(!isMainThread()); 1721 1746 1722 m_databaseReplyQueue.append([protectedThis = makeRef(*this), task = WTFMove(task)]() mutable { 1723 task.performTask(); 1724 }); 1725 ++m_queuedTaskCount; 1726 1747 m_databaseReplyQueue.append(WTFMove(task)); 1727 1748 m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTaskReply)); 1728 1749 } … … 1731 1752 { 1732 1753 ASSERT(!isMainThread()); 1733 ASSERT( m_queuedTaskCount);1754 ASSERT(!m_databaseQueue.isKilled()); 1734 1755 1735 1756 auto task = m_databaseQueue.tryGetMessage(); 1736 1757 ASSERT(task); 1737 1758 1738 (*task)(); 1739 --m_queuedTaskCount; 1740 1741 // Release the task on the main thread in case it holds the last reference to this, 1742 // as UniqueIDBDatabase objects must be deleted on the main thread. 1743 callOnMainThread([task = WTFMove(task)] { 1744 }); 1759 task->performTask(); 1745 1760 } 1746 1761 … … 1748 1763 { 1749 1764 ASSERT(isMainThread()); 1750 ASSERT( m_queuedTaskCount);1765 ASSERT(!m_databaseReplyQueue.isKilled()); 1751 1766 1752 1767 auto task = m_databaseReplyQueue.tryGetMessage(); 1753 1768 ASSERT(task); 1754 1769 1755 (*task)(); 1756 --m_queuedTaskCount; 1770 task->performTask(); 1757 1771 1758 1772 // If this database was force closed (e.g. for a user delete) and there are no more … … 1763 1777 void UniqueIDBDatabase::maybeFinishHardClose() 1764 1778 { 1765 if (m_ hardCloseProtector&& isDoneWithHardClose()) {1779 if (m_owningPointerForClose && isDoneWithHardClose()) { 1766 1780 callOnMainThread([this] { 1767 1781 ASSERT(isDoneWithHardClose()); 1768 m_ hardCloseProtector= nullptr;1782 m_owningPointerForClose = nullptr; 1769 1783 }); 1770 1784 } … … 1773 1787 bool UniqueIDBDatabase::isDoneWithHardClose() 1774 1788 { 1775 return !m_queuedTaskCount&& m_clientClosePendingDatabaseConnections.isEmpty() && m_serverClosePendingDatabaseConnections.isEmpty();1789 return m_databaseQueue.isKilled() && m_clientClosePendingDatabaseConnections.isEmpty() && m_serverClosePendingDatabaseConnections.isEmpty(); 1776 1790 } 1777 1791 … … 1789 1803 LOG(IndexedDB, "UniqueIDBDatabase::immediateCloseForUserDelete - Cancelling (%i, %i, %i, %i) callbacks", m_errorCallbacks.size(), m_keyDataCallbacks.size(), m_getResultCallbacks.size(), m_countCallbacks.size()); 1790 1804 1805 ASSERT(isMainThread()); 1806 1791 1807 // Error out all transactions 1792 1808 Vector<IDBResourceIdentifier> inProgressIdentifiers; … … 1848 1864 // database connections confirm that they have closed. 1849 1865 m_hardClosedForUserDelete = true; 1850 m_hardCloseProtector = this; 1866 1867 // Remove this UniqueIDBDatabase from the IDBServer's set of open databases, and let it own itself. 1868 // It will dispatch back to the main thread later to finalize deleting itself. 1869 m_owningPointerForClose = m_server.closeAndTakeUniqueIDBDatabase(*this); 1851 1870 1852 1871 // Have the database unconditionally delete itself on the database task queue. 1853 1872 postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performUnconditionalDeleteBackingStore)); 1854 1855 // Remove the database from the IDBServer's set of open databases.1856 // If there is no in-progress background thread activity for this database, it will be deleted here.1857 m_server.closeUniqueIDBDatabase(*this);1858 1873 } 1859 1874 -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
r218803 r219298 43 43 #include <wtf/HashSet.h> 44 44 #include <wtf/ListHashSet.h> 45 #include <wtf/Ref.h>46 #include <wtf/ThreadSafeRefCounted.h>47 45 48 46 namespace JSC { … … 75 73 typedef Function<void(const IDBError&, uint64_t)> CountCallback; 76 74 77 class UniqueIDBDatabase : public ThreadSafeRefCounted<UniqueIDBDatabase>{75 class UniqueIDBDatabase { 78 76 public: 79 static Ref<UniqueIDBDatabase> create(IDBServer& server, const IDBDatabaseIdentifier& identifier) 80 { 81 return adoptRef(*new UniqueIDBDatabase(server, identifier)); 82 } 83 77 UniqueIDBDatabase(IDBServer&, const IDBDatabaseIdentifier&); 78 UniqueIDBDatabase(UniqueIDBDatabase&) = delete; 84 79 WEBCORE_EXPORT ~UniqueIDBDatabase(); 85 80 … … 125 120 126 121 private: 127 UniqueIDBDatabase(IDBServer&, const IDBDatabaseIdentifier&);128 129 122 void handleDatabaseOperations(); 130 123 void handleCurrentOperation(); … … 144 137 145 138 void connectionClosedFromServer(UniqueIDBDatabaseConnection&); 139 140 void scheduleShutdownForClose(); 146 141 147 142 // Database thread operations … … 170 165 void performActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBTransactionInfo&); 171 166 void performUnconditionalDeleteBackingStore(); 167 void shutdownForClose(); 172 168 173 169 // Main thread callbacks … … 192 188 void didPerformActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBError&); 193 189 void didPerformUnconditionalDeleteBackingStore(); 190 void didShutdownForClose(); 194 191 195 192 uint64_t storeCallbackOrFireError(ErrorCallback&&); … … 266 263 bool m_deleteBackingStoreInProgress { false }; 267 264 268 CrossThreadQueue<Function<void ()>> m_databaseQueue; 269 CrossThreadQueue<Function<void ()>> m_databaseReplyQueue; 270 std::atomic<uint64_t> m_queuedTaskCount { 0 }; 265 CrossThreadQueue<CrossThreadTask> m_databaseQueue; 266 CrossThreadQueue<CrossThreadTask> m_databaseReplyQueue; 271 267 272 268 bool m_hardClosedForUserDelete { false }; 273 RefPtr<UniqueIDBDatabase> m_hardCloseProtector;274 275 Hash Map<IDBResourceIdentifier, RefPtr<UniqueIDBDatabase>> m_prefetchProtectors;269 std::unique_ptr<UniqueIDBDatabase> m_owningPointerForClose; 270 271 HashSet<IDBResourceIdentifier> m_cursorPrefetches; 276 272 }; 277 273
Note: See TracChangeset
for help on using the changeset viewer.