RESOLVED WONTFIX144242
Refactor and streamline IDBDatabase
https://bugs.webkit.org/show_bug.cgi?id=144242
Summary Refactor and streamline IDBDatabase
Darin Adler
Reported 2015-04-26 17:41:00 PDT
Refactor IDBDatabase to eliminate crash where it is destroyed in the middle of closeConnection
Attachments
Patch (34.07 KB, patch)
2015-04-26 18:01 PDT, Darin Adler
mitz: review-
buildbot: commit-queue-
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (634.44 KB, application/zip)
2015-04-26 18:56 PDT, Build Bot
no flags
Darin Adler
Comment 1 2015-04-26 18:01:44 PDT
Darin Adler
Comment 2 2015-04-26 18:02:28 PDT
Darin Adler
Comment 3 2015-04-26 18:02:42 PDT
I uploaded this patch after I got it to compile but before I ran the tests.
Ryosuke Niwa
Comment 4 2015-04-26 18:23:54 PDT
Comment on attachment 251715 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251715&action=review > Source/WebCore/ChangeLog:28 > + (WebCore::IDBDatabase::createObjectStore): Use nullptr instead of 0. Use autoincrement for > + the store id. Use add instead of set for the HahsSet. Changed the return type. Added a check > + so we throw an exception if this is called while closing. Is it possible to add a test for that? > Source/WebCore/ChangeLog:30 > + (WebCore::IDBDatabase::deleteObjectStore): Added a check so we throw an exception if this is > + called while closing. Ditto. > Source/WebCore/Modules/indexeddb/IDBDatabase.cpp:176 > - int64_t objectStoreId = m_metadata.maxObjectStoreId + 1; > + int64_t objectStoreId = m_metadata.maxObjectStoreId++; > m_backend->createObjectStore(m_versionChangeTransaction->id(), objectStoreId, name, keyPath, autoIncrement); Can we split this into a refactoring & the fix? It's really hard to see the actual logic change with all these refactoring merged in. e.g. here, we're updating m_metadata.maxObjectStoreId earlier than we used to. > Source/WebCore/Modules/indexeddb/IDBDatabase.cpp:187 > - if (!m_versionChangeTransaction) { > + if (!m_versionChangeTransaction || m_isClosing) { And we're checking m_isClosing here.
Build Bot
Comment 5 2015-04-26 18:56:49 PDT
Comment on attachment 251715 [details] Patch Attachment 251715 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5413859552657408 New failing tests: storage/indexeddb/objectstore-removeobjectstore.html storage/indexeddb/mozilla/remove-objectstore.html
Build Bot
Comment 6 2015-04-26 18:56:52 PDT
Created attachment 251718 [details] Archive of layout-test-results from ews107 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
mitz
Comment 7 2015-04-26 19:24:20 PDT
Comment on attachment 251715 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251715&action=review > Source/WebCore/ChangeLog:28 > + (WebCore::IDBDatabase::createObjectStore): Use nullptr instead of 0. Use autoincrement for > + the store id. Use add instead of set for the HahsSet. Changed the return type. Added a check > + so we throw an exception if this is called while closing. No way to create a test for this behavior? > Source/WebCore/ChangeLog:30 > + (WebCore::IDBDatabase::deleteObjectStore): Added a check so we throw an exception if this is > + called while closing. And this? > Source/WebCore/Modules/indexeddb/IDBDatabase.cpp:250 > + // If so, then this code wonât work, trying to iterate a map while it's being modified. Are we using non-ASCII characters in comments now?
mitz
Comment 8 2015-04-26 19:25:54 PDT
Comment on attachment 251715 [details] Patch r- because the test failures look legitimate
Darin Adler
Comment 9 2015-10-18 15:22:23 PDT
I’ll let Brady tackle this during his project to improve indexed database implementation. Not sure this patch has any value at this point.
Brady Eidson
Comment 10 2015-10-18 21:52:46 PDT
(In reply to comment #9) > I’ll let Brady tackle this during his project to improve indexed database > implementation. Not sure this patch has any value at this point. The ideas in this patch definitely have value. Some things - like s/0/nullptr/ - are being done as subtasks of 149117 Other things - like Ref instead of RefPtr where possible - are being done as part of 149117, but not at the IDBDatabase level *quite yet* The reason is IDBDatabase is abstract and shared between both the Modern IDB implementation and the still-in-use Legacy IDB implementation. Once Modern is done and Legacy removed then we can finish implementing these ideas at IDBDatabase. But I agree this bug is not useful - That's going to be the final subtask of 149117
Note You need to log in before you can comment on or make changes to this bug.