|Summary:||IndexedDB: destroy UniqueIDBDatabase when it's not used|
|Product:||WebKit||Reporter:||Sihui Liu <sihui_liu>|
|Component:||WebCore Misc.||Assignee:||Sihui Liu <sihui_liu>|
|Severity:||Normal||CC:||alecflett, beidson, commit-queue, ews-watchlist, ggaren, jsbell, webkit-bug-importer|
|Version:||WebKit Nightly Build|
|Bug Depends on:||209700|
Description Sihui Liu 2020-03-24 22:58:33 PDT
If connections of a UniqueIDBDatabase are all closed and there is no pending request on the UniqueIDBDatabase, the UniqueIDBDatabase may not be used any more.
Comment 2 Geoffrey Garen 2020-03-25 12:33:53 PDT
What's the motivation for this change? Can we test it somehow?
Comment 3 Sihui Liu 2020-03-25 13:42:07 PDT
(In reply to Geoffrey Garen from comment #2) > What's the motivation for this change? > > Can we test it somehow? It is actually the old behavior before IDB background thread change. We don't want to keep the UniqueIDBDatabase objects in memory if they may never be used again. Current behavior is once UniqueIDBDatabase is created it will be in the map unless IDB data is deleted. I've tested the patch this manually. This should not cause any behavior change other than less memory in the case of opening a lot of IDBDatabase, closing them, and never using them again.
Comment 4 Geoffrey Garen 2020-03-25 16:32:37 PDT
Comment on attachment 394473 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394473&action=review r=me > Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp:1198 > +void UniqueIDBDatabase::destroyIfPossible() Does this function delete the UniqueIDBDatabase object, or just disconnect it from the server? I think a better name might be "tryRemoveFromServer" or "tryClose".
Comment 5 Sihui Liu 2020-03-25 17:56:18 PDT
Comment on attachment 394473 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394473&action=review >> Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp:1198 >> +void UniqueIDBDatabase::destroyIfPossible() > > Does this function delete the UniqueIDBDatabase object, or just disconnect it from the server? > > I think a better name might be "tryRemoveFromServer" or "tryClose". IDBServer owns UniqueIDBDatabase; this function deletes the object by removing it from the IDBServer. Will change the name to tryCloseAndRemoveFromServer.
Comment 7 EWS 2020-03-25 23:26:57 PDT
Committed r259034: <https://trac.webkit.org/changeset/259034> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394581 [details].