Changeset 194414 in webkit
- Timestamp:
- Dec 23, 2015, 11:40:29 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/platform/mac-wk1/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/server/IDBServer.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (modified) (5 diffs)
-
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (modified) (2 diffs)
-
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r194413 r194414 1 2015-12-23 Brady Eidson <beidson@apple.com> 2 3 Modern IDB: Don't open any new connections until after version change transactions are completely handled. 4 https://bugs.webkit.org/show_bug.cgi?id=152441 5 6 Reviewed by Alex Christensen. 7 8 * platform/mac-wk1/TestExpectations: Enable 4 now-passing tests. 9 1 10 2015-12-23 Brady Eidson <beidson@apple.com> 2 11 -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r194413 r194414 100 100 storage/indexeddb/delete-closed-database-object.html [ Failure ] 101 101 storage/indexeddb/intversion-gated-on-delete.html [ Failure ] 102 storage/indexeddb/intversion-open-in-upgradeneeded.html [ Failure ]103 storage/indexeddb/intversion-pending-version-changes-descending.html [ Failure ]104 storage/indexeddb/intversion-pending-version-changes-same.html [ Failure ]105 storage/indexeddb/intversion-two-opens-no-versions.html [ Failure ]106 102 storage/indexeddb/odd-strings.html [ Failure ] 107 103 storage/indexeddb/open-db-private-browsing.html [ Failure ] -
trunk/Source/WebCore/ChangeLog
r194413 r194414 1 2015-12-23 Brady Eidson <beidson@apple.com> 2 3 Modern IDB: Don't open any new connections until after version change transactions are completely handled. 4 https://bugs.webkit.org/show_bug.cgi?id=152441 5 6 Reviewed by Alex Christensen. 7 8 No new tests (At least 4 failing tests now pass). 9 10 When a version change transaction is in progress for a database, the server should not open any new connections 11 to that database until the version change transaction has been 100% completed. 12 13 This means *all* events related to finishing the transaction must fire. 14 15 To support this, a new message from client -> server is added. 16 17 * Modules/indexeddb/client/IDBConnectionToServer.cpp: 18 (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction): 19 * Modules/indexeddb/client/IDBConnectionToServer.h: 20 * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: 21 22 * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp: 23 (WebCore::IDBClient::IDBOpenDBRequest::dispatchEvent): 24 * Modules/indexeddb/client/IDBOpenDBRequestImpl.h: 25 * Modules/indexeddb/client/IDBRequestImpl.h: 26 27 * Modules/indexeddb/server/IDBServer.cpp: 28 (WebCore::IDBServer::IDBServer::didFinishHandlingVersionChangeTransaction): 29 * Modules/indexeddb/server/IDBServer.h: 30 31 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 32 (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations): 33 (WebCore::IDBServer::UniqueIDBDatabase::didFinishHandlingVersionChange): 34 (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction): Deleted. 35 (WebCore::IDBServer::UniqueIDBDatabase::didPerformAbortTransaction): Deleted. 36 (WebCore::IDBServer::UniqueIDBDatabase::inProgressTransactionCompleted): Deleted. 37 * Modules/indexeddb/server/UniqueIDBDatabase.h: 38 39 * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: 40 (WebCore::IDBServer::UniqueIDBDatabaseTransaction::didFinishHandlingVersionChange): 41 * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h: 42 43 * Modules/indexeddb/shared/IDBTransactionInfo.cpp: 44 (WebCore::IDBTransactionInfo::loggingString): 45 * Modules/indexeddb/shared/IDBTransactionInfo.h: 46 47 * Modules/indexeddb/shared/InProcessIDBServer.cpp: 48 (WebCore::InProcessIDBServer::didFinishHandlingVersionChangeTransaction): 49 * Modules/indexeddb/shared/InProcessIDBServer.h: 50 1 51 2015-12-23 Brady Eidson <beidson@apple.com> 2 52 -
trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
r193784 r194414 291 291 } 292 292 293 void IDBConnectionToServer::didFinishHandlingVersionChangeTransaction(IDBTransaction& transaction) 294 { 295 LOG(IndexedDB, "IDBConnectionToServer::didFinishHandlingVersionChangeTransaction"); 296 auto identifier = transaction.info().identifier(); 297 m_delegate->didFinishHandlingVersionChangeTransaction(identifier); 298 } 299 293 300 void IDBConnectionToServer::abortTransaction(IDBTransaction& transaction) 294 301 { -
trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h
r193784 r194414 99 99 void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&); 100 100 101 void didFinishHandlingVersionChangeTransaction(IDBTransaction&); 102 101 103 void abortTransaction(IDBTransaction&); 102 104 void didAbortTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&); -
trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h
r192645 r194414 60 60 virtual void abortTransaction(IDBResourceIdentifier&) = 0; 61 61 virtual void commitTransaction(IDBResourceIdentifier&) = 0; 62 virtual void didFinishHandlingVersionChangeTransaction(IDBResourceIdentifier&) = 0; 62 63 virtual void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&) = 0; 63 64 virtual void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) = 0; -
trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp
r194169 r194414 102 102 } 103 103 104 bool IDBOpenDBRequest::dispatchEvent(Event& event) 105 { 106 bool result = IDBRequest::dispatchEvent(event); 107 108 if (m_transaction && m_transaction->isVersionChange() && (event.type() == eventNames().errorEvent || event.type() == eventNames().successEvent)) 109 m_transaction->database().serverConnection().didFinishHandlingVersionChangeTransaction(*m_transaction); 110 111 return result; 112 } 113 104 114 void IDBOpenDBRequest::onSuccess(const IDBResultData& resultData) 105 115 { -
trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h
r194169 r194414 58 58 void fireErrorAfterVersionChangeCompletion(); 59 59 60 virtual bool dispatchEvent(Event&) override final; 61 60 62 private: 61 63 IDBOpenDBRequest(IDBConnectionToServer&, ScriptExecutionContext*, const IDBDatabaseIdentifier&, uint64_t version, IndexedDB::RequestType); -
trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h
r194169 r194414 80 80 81 81 void enqueueEvent(Ref<Event>&&); 82 virtual bool dispatchEvent(Event&) override final;82 virtual bool dispatchEvent(Event&) override; 83 83 84 84 IDBConnectionToServer& connection() { return m_connection; } -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
r192687 r194414 318 318 } 319 319 320 void IDBServer::didFinishHandlingVersionChangeTransaction(const IDBResourceIdentifier& transactionIdentifier) 321 { 322 LOG(IndexedDB, "IDBServer::didFinishHandlingVersionChangeTransaction"); 323 324 auto transaction = m_transactions.get(transactionIdentifier); 325 if (!transaction) 326 return; 327 328 transaction->didFinishHandlingVersionChange(); 329 } 330 320 331 void IDBServer::databaseConnectionClosed(uint64_t databaseConnectionIdentifier) 321 332 { -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h
r192687 r194414 61 61 void abortTransaction(const IDBResourceIdentifier&); 62 62 void commitTransaction(const IDBResourceIdentifier&); 63 void didFinishHandlingVersionChangeTransaction(const IDBResourceIdentifier&); 63 64 void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&); 64 65 void deleteObjectStore(const IDBRequestData&, const String& objectStoreName); -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r194275 r194414 207 207 LOG(IndexedDB, "(main) UniqueIDBDatabase::handleDatabaseOperations - There are %zu pending", m_pendingDatabaseOperations.size()); 208 208 209 if (m_versionChangeDatabaseConnection || m_currentOperation) { 210 // We can't start the next database operation quite yet, but we might need to notify all open connections 211 // about a pending delete. 212 if (!m_pendingDatabaseOperations.isEmpty() && m_pendingDatabaseOperations.first()->isDeleteRequest() && !m_hasNotifiedConnectionsOfDelete) { 213 m_hasNotifiedConnectionsOfDelete = true; 214 notifyConnectionsOfVersionChange(0); 215 } 209 if (m_versionChangeDatabaseConnection || m_versionChangeTransaction || m_currentOperation) { 210 // We can't start any new open-database operations right now, but we might be able to start handling a delete operation. 211 if (!m_currentOperation && !m_pendingDatabaseOperations.isEmpty() && m_pendingDatabaseOperations.first()->isDeleteRequest()) 212 m_currentOperation = m_pendingDatabaseOperations.takeFirst(); 216 213 217 214 // Some operations (such as the first open operation after a delete) require multiple passes to completely handle … … 850 847 ASSERT(m_databaseInfo->version() == transaction.info().newVersion()); 851 848 852 m_versionChangeTransaction = nullptr;853 m_versionChangeDatabaseConnection = nullptr;854 855 849 invokeOperationAndTransactionTimer(); 856 850 } … … 888 882 uint64_t callbackID = storeCallback(callback); 889 883 m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performAbortTransaction, callbackID, transaction.info().identifier())); 884 } 885 886 void UniqueIDBDatabase::didFinishHandlingVersionChange(UniqueIDBDatabaseTransaction& transaction) 887 { 888 ASSERT(isMainThread()); 889 LOG(IndexedDB, "(main) UniqueIDBDatabase::didFinishHandlingVersionChange"); 890 891 ASSERT(m_versionChangeTransaction); 892 ASSERT_UNUSED(transaction, m_versionChangeTransaction == &transaction); 893 894 m_versionChangeTransaction = nullptr; 895 m_versionChangeDatabaseConnection = nullptr; 896 897 invokeOperationAndTransactionTimer(); 890 898 } 891 899 … … 908 916 ASSERT(m_versionChangeTransaction->originalDatabaseInfo()); 909 917 m_databaseInfo = std::make_unique<IDBDatabaseInfo>(*m_versionChangeTransaction->originalDatabaseInfo()); 910 911 m_versionChangeTransaction = nullptr;912 m_versionChangeDatabaseConnection = nullptr;913 918 } 914 919 … … 1095 1100 ASSERT(transaction); 1096 1101 1097 if (m_versionChangeTransaction == transaction)1098 m_versionChangeTransaction = nullptr;1099 1100 1102 for (auto objectStore : transaction->objectStoreIdentifiers()) 1101 1103 m_objectStoreTransactionCounts.remove(objectStore); -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
r194263 r194414 93 93 void commitTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback); 94 94 void abortTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback); 95 void didFinishHandlingVersionChange(UniqueIDBDatabaseTransaction&); 95 96 void transactionDestroyed(UniqueIDBDatabaseTransaction&); 96 97 void connectionClosedFromClient(UniqueIDBDatabaseConnection&); … … 184 185 185 186 RefPtr<UniqueIDBDatabaseConnection> m_versionChangeDatabaseConnection; 186 UniqueIDBDatabaseTransaction* m_versionChangeTransaction { nullptr };187 RefPtr<UniqueIDBDatabaseTransaction> m_versionChangeTransaction; 187 188 188 189 bool m_isOpeningBackingStore { false }; -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp
r192645 r194414 310 310 } 311 311 312 void UniqueIDBDatabaseTransaction::didFinishHandlingVersionChange() 313 { 314 LOG(IndexedDB, "UniqueIDBDatabaseTransaction::didFinishHandlingVersionChange"); 315 ASSERT(isVersionChange()); 316 317 m_databaseConnection->database().didFinishHandlingVersionChange(*this); 318 } 319 312 320 } // namespace IDBServer 313 321 } // namespace WebCore -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h
r192645 r194414 80 80 81 81 void didActivateInBackingStore(const IDBError&); 82 void didFinishHandlingVersionChange(); 82 83 83 84 const Vector<uint64_t>& objectStoreIdentifiers(); -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp
r193643 r194414 28 28 29 29 #if ENABLE(INDEXED_DATABASE) 30 31 #include "IDBTransactionImpl.h" 30 32 31 33 namespace WebCore { … … 81 83 } 82 84 85 #ifndef NDEBUG 86 String IDBTransactionInfo::loggingString() const 87 { 88 String modeString; 89 switch (m_mode) { 90 case IndexedDB::TransactionMode::ReadOnly: 91 modeString = IDBTransaction::modeReadOnly(); 92 break; 93 case IndexedDB::TransactionMode::ReadWrite: 94 modeString = IDBTransaction::modeReadWrite(); 95 break; 96 case IndexedDB::TransactionMode::VersionChange: 97 modeString = IDBTransaction::modeVersionChange(); 98 break; 99 default: 100 ASSERT_NOT_REACHED(); 101 } 102 103 return makeString("Transaction: ", m_identifier.loggingString(), " mode ", modeString, " newVersion ", String::number(m_newVersion)); 104 } 105 #endif 106 83 107 } // namespace WebCore 84 108 -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h
r193643 r194414 62 62 IDBDatabaseInfo* originalDatabaseInfo() const { return m_originalDatabaseInfo.get(); } 63 63 64 #ifndef NDEBUG 65 String loggingString() const; 66 #endif 67 64 68 private: 65 69 IDBTransactionInfo(const IDBResourceIdentifier&); -
trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp
r193784 r194414 225 225 } 226 226 227 void InProcessIDBServer::didFinishHandlingVersionChangeTransaction(IDBResourceIdentifier& transactionIdentifier) 228 { 229 RefPtr<InProcessIDBServer> self(this); 230 RunLoop::current().dispatch([this, self, transactionIdentifier] { 231 m_server->didFinishHandlingVersionChangeTransaction(transactionIdentifier); 232 }); 233 } 234 227 235 void InProcessIDBServer::createObjectStore(const IDBRequestData& resultData, const IDBObjectStoreInfo& info) 228 236 { -
trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h
r193784 r194414 59 59 virtual void abortTransaction(IDBResourceIdentifier&) override final; 60 60 virtual void commitTransaction(IDBResourceIdentifier&) override final; 61 virtual void didFinishHandlingVersionChangeTransaction(IDBResourceIdentifier&) override final; 61 62 virtual void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&) override final; 62 63 virtual void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) override final;
Note:
See TracChangeset
for help on using the changeset viewer.