Use Variant instead of raw pointer union in IndexValueEntry#62318
Conversation
|
EWS run on previous version of this PR (hash cff172e) Details
|
cff172e to
5a41d65
Compare
|
EWS run on previous version of this PR (hash 5a41d65) Details |
macOS Safer C++ Build #91808 (5a41d65)❌ Found 1 failing file with 6 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
5a41d65 to
9c7cdd4
Compare
|
EWS run on previous version of this PR (hash 9c7cdd4) Details |
macOS Safer C++ Build #91891 (9c7cdd4)❌ Found 1 failing file with 6 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
| if (m_unique) { | ||
| delete m_key; | ||
| m_key = new IDBKeyData(key); | ||
| if (unique()) { |
There was a problem hiding this comment.
It seems like we can use WTF::visit here?
There was a problem hiding this comment.
Is your suggestion about resolving the SaferCPP errors?
My last attempt used WTF::switchOn (5a41d65) and I got the same SaferCPP errors, so I switched to use std::get to avoid destruction of lambda. But it seems still not work; and I am not sure how to fix the SaferCPP errors.
There was a problem hiding this comment.
The bot is complaining about NODELETE annotation. You could simply remove that from the member function declarations.
There was a problem hiding this comment.
Ok didn't know we can delete annotation; that seems convenient. Though I might get other errors for removing the annotation.
iOS Safer C++ Build #10774 (9c7cdd4)❌ Found 1 failing file with 6 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
9c7cdd4 to
5d30bf5
Compare
|
EWS run on previous version of this PR (hash 5d30bf5) Details |
macOS Safer C++ Build #92083 (5d30bf5)❌ Found 1 failing file with 1 issue. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
iOS Safer C++ Build #10976 (5d30bf5)❌ Found 1 failing file with 1 issue. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
5d30bf5 to
288ba81
Compare
|
EWS run on current version of this PR (hash 288ba81) Details
|
https://bugs.webkit.org/show_bug.cgi?id=311777 rdar://174363490 Reviewed by Ryosuke Niwa. Replace the union of raw IDBKeyData*/IDBKeyDataSet* with Variant<std::optional<IDBKeyData>, IDBKeyDataSet>, which manages lifetime automatically and provides type safety via WTF::switchOn. This eliminates the manual destructor, the m_unique bool, and all heap allocations for the unique-index case. Remove some NODELETE annotations since new implementation gets "it contains code that could destruct an object" SaferCPP error because of them. * Source/WebCore/Modules/indexeddb/server/IndexValueEntry.cpp: (WebCore::IDBServer::constructEmptyKeys): (WebCore::IDBServer::IndexValueEntry::IndexValueEntry): (WebCore::IDBServer::IndexValueEntry::addKey): (WebCore::IDBServer::IndexValueEntry::removeKey): (WebCore::IDBServer::IndexValueEntry::contains): (WebCore::IDBServer::IndexValueEntry::getCount const): (WebCore::IDBServer::IndexValueEntry::Iterator::Iterator): (WebCore::IDBServer::IndexValueEntry::Iterator::key const): (WebCore::IDBServer::IndexValueEntry::Iterator::isValid const): (WebCore::IDBServer::IndexValueEntry::Iterator::operator++): (WebCore::IDBServer::IndexValueEntry::keys const): (WebCore::IDBServer::IndexValueEntry::~IndexValueEntry): Deleted. * Source/WebCore/Modules/indexeddb/server/IndexValueEntry.h: (WebCore::IDBServer::IndexValueEntry::isUnique const): (WebCore::IDBServer::IndexValueEntry::unique const): Deleted. * Source/WebCore/Modules/indexeddb/server/IndexValueStore.h: Canonical link: https://commits.webkit.org/311131@main
288ba81 to
86df899
Compare
|
Committed 311131@main (86df899): https://commits.webkit.org/311131@main Reviewed commits have been landed. Closing PR #62318 and removing active labels. |
🧪 api-wpe
86df899
288ba81
🛠 win🧪 wpe-wk2🧪 win-tests🧪 ios-wk2-wpt🧪 api-mac-debug🧪 mac-wk1🧪 gtk-wk2🛠 vision🧪 mac-AS-debug-wk2🛠 playstation🧪 vision-wk2🧪 mac-intel-wk2🛠 tv-sim🛠 watch