Changeset 259215 in webkit
- Timestamp:
- Mar 30, 2020 12:23:05 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r259210 r259215 1 2020-03-30 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: destroy UniqueIDBDatabase when it's not used 4 https://bugs.webkit.org/show_bug.cgi?id=209532 5 <rdar://problem/60906908> 6 7 Reviewed by Geoffrey Garen. 8 9 When all connections of a UniqueIDBDatabase object are closed and there are no pending reuqests, the 10 object may not be used any more. We should delete it for better memory use. 11 12 * Modules/indexeddb/server/IDBServer.cpp: 13 (WebCore::IDBServer::IDBServer::deleteDatabase): 14 (WebCore::IDBServer::IDBServer::establishTransaction): 15 (WebCore::IDBServer::IDBServer::databaseConnectionClosed): 16 (WebCore::IDBServer::IDBServer::openDBRequestCancelled): 17 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 18 (WebCore::IDBServer::UniqueIDBDatabase::tryClose): 19 * Modules/indexeddb/server/UniqueIDBDatabase.h: 20 1 21 2020-03-30 Jack Lee <shihchieh_lee@apple.com> 2 22 -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
r259156 r259215 170 170 171 171 database->handleDelete(*connection, requestData); 172 if (database->tryClose()) 173 m_uniqueIDBDatabaseMap.remove(database->identifier()); 172 174 } 173 175 … … 393 395 ASSERT(m_lock.isHeld()); 394 396 395 auto databaseConnection = m_databaseConnections.get(databaseConnectionIdentifier);397 auto* databaseConnection = m_databaseConnections.get(databaseConnectionIdentifier); 396 398 if (!databaseConnection) 397 399 return; 398 400 401 auto* database = databaseConnection->database(); 399 402 databaseConnection->establishTransaction(info); 403 if (database->tryClose()) 404 m_uniqueIDBDatabaseMap.remove(database->identifier()); 400 405 } 401 406 … … 448 453 ASSERT(m_lock.isHeld()); 449 454 450 auto databaseConnection = m_databaseConnections.get(databaseConnectionIdentifier);455 auto* databaseConnection = m_databaseConnections.get(databaseConnectionIdentifier); 451 456 if (!databaseConnection) 452 457 return; 453 458 459 auto* database = databaseConnection->database(); 454 460 databaseConnection->connectionClosedFromClient(); 461 if (database->tryClose()) 462 m_uniqueIDBDatabaseMap.remove(database->identifier()); 455 463 } 456 464 … … 493 501 494 502 uniqueIDBDatabase->openDBRequestCancelled(requestData.requestIdentifier()); 503 if (uniqueIDBDatabase->tryClose()) 504 m_uniqueIDBDatabaseMap.remove(uniqueIDBDatabase->identifier()); 495 505 } 496 506 -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r259156 r259215 1191 1191 } 1192 1192 1193 bool UniqueIDBDatabase::tryClose() 1194 { 1195 if (m_backingStore && m_backingStore->isEphemeral()) 1196 return false; 1197 1198 if (hasAnyOpenConnections() || m_versionChangeDatabaseConnection) 1199 return false; 1200 1201 close(); 1202 return true; 1203 } 1204 1193 1205 RefPtr<ServerOpenDBRequest> UniqueIDBDatabase::takeNextRunnableRequest(RequestType requestType) 1194 1206 { -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
r259156 r259215 111 111 112 112 void abortActiveTransactions(); 113 bool tryClose(); 113 114 114 115 private:
Note: See TracChangeset
for help on using the changeset viewer.