Changeset 276502 in webkit
- Timestamp:
- Apr 23, 2021, 9:55:47 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 25 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Modules/indexeddb/IDBKeyData.cpp (modified) (1 diff)
-
WebCore/Modules/indexeddb/IDBKeyData.h (modified) (3 diffs)
-
WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp (modified) (1 diff)
-
WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h (modified) (3 diffs)
-
WebCore/PAL/ChangeLog (modified) (1 diff)
-
WebCore/PAL/pal/SessionID.h (modified) (1 diff)
-
WebCore/dom/MessagePortIdentifier.h (modified) (1 diff)
-
WebCore/history/BackForwardItemIdentifier.h (modified) (1 diff)
-
WebCore/layout/LayoutUnits.h (modified) (1 diff)
-
WebCore/loader/PrivateClickMeasurement.h (modified) (6 diffs)
-
WebCore/page/ClientOrigin.h (modified) (1 diff)
-
WebCore/page/GlobalWindowIdentifier.h (modified) (1 diff)
-
WebCore/platform/Cookie.h (modified) (2 diffs)
-
WebCore/platform/graphics/FontCache.cpp (modified) (1 diff)
-
WebCore/platform/graphics/FontCache.h (modified) (1 diff)
-
WebCore/platform/graphics/IntPointHash.h (modified) (1 diff)
-
WebCore/rendering/CSSValueKey.h (modified) (1 diff)
-
WebCore/workers/service/ServiceWorkerClientIdentifier.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/cache/NetworkCache.h (modified) (1 diff)
-
WebKit/Platform/IPC/StringReference.h (modified) (2 diffs)
-
WebKit/Shared/CallbackID.h (modified) (1 diff)
-
WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
WebKitLegacy/mac/History/BinaryPropertyList.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r276500 r276502 1 2021-04-23 Chris Dumez <cdumez@apple.com> 2 3 Improve our constructDeletedValue() template specializations 4 https://bugs.webkit.org/show_bug.cgi?id=224889 5 6 Reviewed by Darin Adler. 7 8 Improve our constructDeletedValue() template specializations and make them more consistent: 9 - Use placement-new instead of object assignment since we don't want/need to destroy the 10 existing object (since it is uninitialized). 11 - Do as little initialization as possible for performance reasons. 12 13 * Modules/indexeddb/IDBKeyData.cpp: 14 (WebCore::IDBKeyData::deletedValue): Deleted. 15 * Modules/indexeddb/IDBKeyData.h: 16 (WebCore::IDBKeyDataHashTraits::constructDeletedValue): 17 (WebCore::IDBKeyDataHashTraits::isDeletedValue): 18 (WebCore::IDBKeyData::isDeletedValue const): Deleted. 19 * Modules/indexeddb/shared/IDBResourceIdentifier.cpp: 20 (WebCore::IDBResourceIdentifier::deletedValue): Deleted. 21 (WebCore::IDBResourceIdentifier::isHashTableDeletedValue const): Deleted. 22 * Modules/indexeddb/shared/IDBResourceIdentifier.h: 23 (WebCore::IDBResourceIdentifierHashTraits::constructDeletedValue): 24 (WebCore::IDBResourceIdentifierHashTraits::isDeletedValue): 25 * dom/MessagePortIdentifier.h: 26 (WTF::HashTraits<WebCore::MessagePortIdentifier>::constructDeletedValue): 27 (WTF::HashTraits<WebCore::MessagePortIdentifier>::isDeletedValue): 28 * history/BackForwardItemIdentifier.h: 29 (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue): 30 (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue): 31 * layout/LayoutUnits.h: 32 (WTF::HashTraits<WebCore::Layout::SlotPosition>::constructDeletedValue): 33 (WTF::HashTraits<WebCore::Layout::SlotPosition>::isDeletedValue): 34 * loader/PrivateClickMeasurement.h: 35 (WebCore::PrivateClickMeasurement::AttributionDestinationSite::matches const): 36 (WTF::HashTraits<WebCore::PrivateClickMeasurement::SourceSite>::constructDeletedValue): 37 (WTF::HashTraits<WebCore::PrivateClickMeasurement::SourceSite>::isDeletedValue): 38 (WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::constructDeletedValue): 39 (WTF::HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite>::isDeletedValue): 40 (WebCore::PrivateClickMeasurement::SourceSite::isHashTableDeletedValue const): Deleted. 41 (WebCore::PrivateClickMeasurement::SourceSite::deletedValue): Deleted. 42 (WebCore::PrivateClickMeasurement::SourceSite::constructDeletedValue): Deleted. 43 (WebCore::PrivateClickMeasurement::SourceSite::deleteValue): Deleted. 44 (WebCore::PrivateClickMeasurement::SourceSite::isDeletedValue const): Deleted. 45 (WebCore::PrivateClickMeasurement::AttributionDestinationSite::isHashTableDeletedValue const): Deleted. 46 (WebCore::PrivateClickMeasurement::AttributionDestinationSite::deletedValue): Deleted. 47 (WebCore::PrivateClickMeasurement::AttributionDestinationSite::constructDeletedValue): Deleted. 48 (WebCore::PrivateClickMeasurement::AttributionDestinationSite::deleteValue): Deleted. 49 (WebCore::PrivateClickMeasurement::AttributionDestinationSite::isDeletedValue const): Deleted. 50 * page/ClientOrigin.h: 51 (WTF::HashTraits<WebCore::ClientOrigin>::constructDeletedValue): 52 * page/GlobalWindowIdentifier.h: 53 (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue): 54 (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue): 55 * platform/Cookie.h: 56 (WTF::HashTraits<WebCore::Cookie>::constructDeletedValue): 57 (WebCore::Cookie::Cookie): Deleted. 58 * platform/graphics/FontCache.cpp: 59 (WebCore::FontPlatformDataCacheKeyHashTraits::constructDeletedValue): 60 * platform/graphics/FontCache.h: 61 (WebCore::FontCascadeCacheKeyHashTraits::constructDeletedValue): 62 * platform/graphics/IntPointHash.h: 63 (WTF::HashTraits<WebCore::IntPoint>::constructDeletedValue): 64 (WTF::HashTraits<WebCore::IntPoint>::isDeletedValue): 65 * rendering/CSSValueKey.h: 66 (WTF::HashTraits<WebCore::CSSValueKey>::constructDeletedValue): 67 * workers/service/ServiceWorkerClientIdentifier.h: 68 (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::constructDeletedValue): 69 (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::isDeletedValue): 70 1 71 2021-04-23 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 72 -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp
r275151 r276502 421 421 } 422 422 423 IDBKeyData IDBKeyData::deletedValue()424 {425 IDBKeyData result;426 result.m_isNull = false;427 result.m_isDeletedValue = true;428 return result;429 }430 431 423 bool IDBKeyData::isValid() const 432 424 { -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h
r275547 r276502 153 153 } 154 154 155 static IDBKeyData deletedValue();156 bool isDeletedValue() const { return m_isDeletedValue; }157 158 155 String string() const 159 156 { … … 189 186 190 187 private: 188 friend struct IDBKeyDataHashTraits; 189 191 190 static void isolatedCopy(const IDBKeyData& source, IDBKeyData& destination); 192 191 … … 208 207 static const bool hasIsEmptyValueFunction = true; 209 208 210 static void constructDeletedValue(IDBKeyData& key) 211 { 212 new (&key) IDBKeyData; 213 key = IDBKeyData::deletedValue(); 214 } 215 216 static bool isDeletedValue(const IDBKeyData& key) 217 { 218 return key.isDeletedValue(); 219 } 209 static void constructDeletedValue(IDBKeyData& key) { key.m_isDeletedValue = true; } 210 static bool isDeletedValue(const IDBKeyData& key) { return key.m_isDeletedValue; } 220 211 221 212 static IDBKeyData emptyValue() -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp
r275151 r276502 85 85 } 86 86 87 IDBResourceIdentifier IDBResourceIdentifier::deletedValue()88 {89 return IDBResourceIdentifier(IDBConnectionIdentifier { WTF::HashTableDeletedValue }, std::numeric_limits<uint64_t>::max());90 }91 92 bool IDBResourceIdentifier::isHashTableDeletedValue() const93 {94 return m_idbConnectionIdentifier.isHashTableDeletedValue() && m_resourceNumber == std::numeric_limits<uint64_t>::max();95 }96 97 87 #if !LOG_DISABLED 98 88 -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h
r275151 r276502 50 50 explicit IDBResourceIdentifier(const IDBServer::IDBConnectionToClient&); 51 51 52 static IDBResourceIdentifier deletedValue();53 WEBCORE_EXPORT bool isHashTableDeletedValue() const;54 55 52 static IDBResourceIdentifier emptyValue(); 56 53 bool isEmpty() const … … 85 82 86 83 private: 84 friend struct IDBResourceIdentifierHashTraits; 85 87 86 IDBResourceIdentifier(IDBConnectionIdentifier, uint64_t resourceIdentifier); 88 87 IDBConnectionIdentifier m_idbConnectionIdentifier; … … 112 111 static void constructDeletedValue(IDBResourceIdentifier& identifier) 113 112 { 114 identifier = IDBResourceIdentifier::deletedValue();113 new (NotNull, &identifier.m_idbConnectionIdentifier) IDBConnectionIdentifier(WTF::HashTableDeletedValue); 115 114 } 116 115 117 116 static bool isDeletedValue(const IDBResourceIdentifier& identifier) 118 117 { 119 return identifier. isHashTableDeletedValue();118 return identifier.m_idbConnectionIdentifier.isHashTableDeletedValue(); 120 119 } 121 120 }; -
trunk/Source/WebCore/PAL/ChangeLog
r276340 r276502 1 2021-04-23 Chris Dumez <cdumez@apple.com> 2 3 Improve our constructDeletedValue() template specializations 4 https://bugs.webkit.org/show_bug.cgi?id=224889 5 6 Reviewed by Darin Adler. 7 8 * pal/SessionID.h: 9 (WTF::HashTraits<PAL::SessionID>::constructDeletedValue): 10 1 11 2021-04-20 Brent Fulgham <bfulgham@apple.com> 2 12 -
trunk/Source/WebCore/PAL/pal/SessionID.h
r264488 r276502 116 116 template<> struct HashTraits<PAL::SessionID> : GenericHashTraits<PAL::SessionID> { 117 117 static PAL::SessionID emptyValue() { return PAL::SessionID(HashTableEmptyValue); } 118 static void constructDeletedValue(PAL::SessionID& slot) { slot =PAL::SessionID(HashTableDeletedValue); }118 static void constructDeletedValue(PAL::SessionID& slot) { new (NotNull, &slot) PAL::SessionID(HashTableDeletedValue); } 119 119 static bool isDeletedValue(const PAL::SessionID& slot) { return slot.isHashTableDeletedValue(); } 120 120 }; -
trunk/Source/WebCore/dom/MessagePortIdentifier.h
r264488 r276502 101 101 static WebCore::MessagePortIdentifier emptyValue() { return { }; } 102 102 103 static void constructDeletedValue(WebCore::MessagePortIdentifier& slot) { slot.processIdentifier = makeObjectIdentifier<WebCore::ProcessIdentifierType>(std::numeric_limits<uint64_t>::max()); }103 static void constructDeletedValue(WebCore::MessagePortIdentifier& slot) { new (NotNull, &slot.processIdentifier) WebCore::ProcessIdentifier(WTF::HashTableDeletedValue); } 104 104 105 static bool isDeletedValue(const WebCore::MessagePortIdentifier& slot) { return slot.processIdentifier. toUInt64() == std::numeric_limits<uint64_t>::max(); }105 static bool isDeletedValue(const WebCore::MessagePortIdentifier& slot) { return slot.processIdentifier.isHashTableDeletedValue(); } 106 106 }; 107 107 -
trunk/Source/WebCore/history/BackForwardItemIdentifier.h
r264488 r276502 115 115 static WebCore::BackForwardItemIdentifier emptyValue() { return { }; } 116 116 117 static void constructDeletedValue(WebCore::BackForwardItemIdentifier& slot) { slot.processIdentifier = ObjectIdentifier<WebCore::ProcessIdentifierType>(HashTableDeletedValue); }117 static void constructDeletedValue(WebCore::BackForwardItemIdentifier& slot) { new (NotNull, &slot.processIdentifier) WebCore::ProcessIdentifier(WTF::HashTableDeletedValue); } 118 118 119 static bool isDeletedValue(const WebCore::BackForwardItemIdentifier& slot) { return slot.processIdentifier. toUInt64() == std::numeric_limits<uint64_t>::max(); }119 static bool isDeletedValue(const WebCore::BackForwardItemIdentifier& slot) { return slot.processIdentifier.isHashTableDeletedValue(); } 120 120 }; 121 121 -
trunk/Source/WebCore/layout/LayoutUnits.h
r268456 r276502 245 245 static WebCore::Layout::SlotPosition emptyValue() { return WebCore::Layout::SlotPosition(0, std::numeric_limits<size_t>::max()); } 246 246 247 static void constructDeletedValue(WebCore::Layout::SlotPosition& slot) { slot = WebCore::Layout::SlotPosition(std::numeric_limits<size_t>::max(), 0); }248 static bool isDeletedValue(const WebCore::Layout::SlotPosition& slot) { return slot == WebCore::Layout::SlotPosition(std::numeric_limits<size_t>::max(), 0); }247 static void constructDeletedValue(WebCore::Layout::SlotPosition& slot) { slot.column = std::numeric_limits<size_t>::max(); } 248 static bool isDeletedValue(const WebCore::Layout::SlotPosition& slot) { return slot.column == std::numeric_limits<size_t>::max(); } 249 249 }; 250 250 template<> struct DefaultHash<WebCore::Layout::SlotPosition> : SlotPositionHash { }; -
trunk/Source/WebCore/loader/PrivateClickMeasurement.h
r275137 r276502 85 85 } 86 86 87 explicit SourceSite(WTF::HashTableDeletedValueType)88 : registrableDomain(WTF::HashTableDeletedValue)89 {90 }91 92 87 bool operator==(const SourceSite& other) const 93 88 { … … 98 93 { 99 94 return registrableDomain.matches(url); 100 }101 102 bool isHashTableDeletedValue() const103 {104 return registrableDomain.isHashTableDeletedValue();105 }106 107 static SourceSite deletedValue()108 {109 return SourceSite { WTF::HashTableDeletedValue };110 }111 112 static void constructDeletedValue(SourceSite& sourceSite)113 {114 new (&sourceSite) SourceSite;115 sourceSite = SourceSite::deletedValue();116 }117 118 void deleteValue()119 {120 registrableDomain = RegistrableDomain { WTF::HashTableDeletedValue };121 }122 123 bool isDeletedValue() const124 {125 return isHashTableDeletedValue();126 95 } 127 96 … … 150 119 } 151 120 152 explicit AttributionDestinationSite(WTF::HashTableDeletedValueType)153 : registrableDomain { WTF::HashTableDeletedValue }154 {155 }156 157 121 explicit AttributionDestinationSite(RegistrableDomain&& domain) 158 122 : registrableDomain { WTFMove(domain) } … … 168 132 { 169 133 return registrableDomain == RegistrableDomain { url }; 170 }171 172 bool isHashTableDeletedValue() const173 {174 return registrableDomain.isHashTableDeletedValue();175 }176 177 static AttributionDestinationSite deletedValue()178 {179 return AttributionDestinationSite { WTF::HashTableDeletedValue };180 }181 182 static void constructDeletedValue(AttributionDestinationSite& destinationSite)183 {184 new (&destinationSite) AttributionDestinationSite;185 destinationSite = AttributionDestinationSite::deletedValue();186 }187 188 void deleteValue()189 {190 registrableDomain = RegistrableDomain { WTF::HashTableDeletedValue };191 }192 193 bool isDeletedValue() const194 {195 return isHashTableDeletedValue();196 134 } 197 135 … … 585 523 template<> struct HashTraits<WebCore::PrivateClickMeasurement::SourceSite> : GenericHashTraits<WebCore::PrivateClickMeasurement::SourceSite> { 586 524 static WebCore::PrivateClickMeasurement::SourceSite emptyValue() { return { }; } 587 static void constructDeletedValue(WebCore::PrivateClickMeasurement::SourceSite& slot) { WebCore::PrivateClickMeasurement::SourceSite::constructDeletedValue(slot); }588 static bool isDeletedValue(const WebCore::PrivateClickMeasurement::SourceSite& slot) { return slot. isDeletedValue(); }525 static void constructDeletedValue(WebCore::PrivateClickMeasurement::SourceSite& slot) { new (NotNull, &slot.registrableDomain) WebCore::RegistrableDomain(WTF::HashTableDeletedValue); } 526 static bool isDeletedValue(const WebCore::PrivateClickMeasurement::SourceSite& slot) { return slot.registrableDomain.isHashTableDeletedValue(); } 589 527 }; 590 528 … … 592 530 template<> struct HashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite> : GenericHashTraits<WebCore::PrivateClickMeasurement::AttributionDestinationSite> { 593 531 static WebCore::PrivateClickMeasurement::AttributionDestinationSite emptyValue() { return { }; } 594 static void constructDeletedValue(WebCore::PrivateClickMeasurement::AttributionDestinationSite& slot) { WebCore::PrivateClickMeasurement::AttributionDestinationSite::constructDeletedValue(slot); }595 static bool isDeletedValue(const WebCore::PrivateClickMeasurement::AttributionDestinationSite& slot) { return slot. isDeletedValue(); }532 static void constructDeletedValue(WebCore::PrivateClickMeasurement::AttributionDestinationSite& slot) { new (NotNull, &slot.registrableDomain) WebCore::RegistrableDomain(WTF::HashTableDeletedValue); } 533 static bool isDeletedValue(const WebCore::PrivateClickMeasurement::AttributionDestinationSite& slot) { return slot.registrableDomain.isHashTableDeletedValue(); } 596 534 }; 597 535 } -
trunk/Source/WebCore/page/ClientOrigin.h
r264488 r276502 103 103 static WebCore::ClientOrigin emptyValue() { return WebCore::ClientOrigin::emptyKey(); } 104 104 105 static void constructDeletedValue(WebCore::ClientOrigin& slot) { slot.topOrigin = WebCore::SecurityOriginData(HashTableDeletedValue); }105 static void constructDeletedValue(WebCore::ClientOrigin& slot) { new (NotNull, &slot.topOrigin) WebCore::SecurityOriginData(WTF::HashTableDeletedValue); } 106 106 static bool isDeletedValue(const WebCore::ClientOrigin& slot) { return slot.topOrigin.isHashTableDeletedValue(); } 107 107 }; -
trunk/Source/WebCore/page/GlobalWindowIdentifier.h
r264488 r276502 95 95 static WebCore::GlobalWindowIdentifier emptyValue() { return { }; } 96 96 97 static void constructDeletedValue(WebCore::GlobalWindowIdentifier& slot) { slot.windowIdentifier = makeObjectIdentifier<WebCore::WindowIdentifierType>(std::numeric_limits<uint64_t>::max()); }98 static bool isDeletedValue(const WebCore::GlobalWindowIdentifier& slot) { return slot.windowIdentifier. toUInt64() == std::numeric_limits<uint64_t>::max(); }97 static void constructDeletedValue(WebCore::GlobalWindowIdentifier& slot) { new (NotNull, &slot.windowIdentifier) WebCore::WindowIdentifier(WTF::HashTableDeletedValue); } 98 static bool isDeletedValue(const WebCore::GlobalWindowIdentifier& slot) { return slot.windowIdentifier.isHashTableDeletedValue(); } 99 99 }; 100 100 -
trunk/Source/WebCore/platform/Cookie.h
r264488 r276502 44 44 struct Cookie { 45 45 Cookie() = default; 46 Cookie(WTF::HashTableDeletedValueType)47 : name(WTF::HashTableDeletedValue)48 {49 }50 46 51 47 template<class Encoder> void encode(Encoder&) const; … … 174 170 template<> struct HashTraits<WebCore::Cookie> : GenericHashTraits<WebCore::Cookie> { 175 171 static WebCore::Cookie emptyValue() { return { }; } 176 static void constructDeletedValue(WebCore::Cookie& slot) { slot = WebCore::Cookie(WTF::HashTableDeletedValue); }172 static void constructDeletedValue(WebCore::Cookie& slot) { new (NotNull, &slot.name) String(WTF::HashTableDeletedValue); } 177 173 static bool isDeletedValue(const WebCore::Cookie& slot) { return slot.name.isHashTableDeletedValue(); } 178 174 -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r276450 r276502 100 100 static void constructDeletedValue(FontPlatformDataCacheKey& slot) 101 101 { 102 new (NotNull, &slot ) FontPlatformDataCacheKey { FontDescriptionKey { WTF::HashTableDeletedValue }, { }, { }, { } };102 new (NotNull, &slot.descriptionKey) FontDescriptionKey(WTF::HashTableDeletedValue); 103 103 } 104 104 static bool isDeletedValue(const FontPlatformDataCacheKey& key) -
trunk/Source/WebCore/platform/graphics/FontCache.h
r276450 r276502 208 208 struct FontCascadeCacheKeyHashTraits : HashTraits<FontCascadeCacheKey> { 209 209 static FontCascadeCacheKey emptyValue() { return { }; } 210 static void constructDeletedValue(FontCascadeCacheKey& slot) { new (NotNull, &slot ) FontCascadeCacheKey { FontDescriptionKey { WTF::HashTableDeletedValue }, { }, { }, { } }; }210 static void constructDeletedValue(FontCascadeCacheKey& slot) { new (NotNull, &slot.fontDescriptionKey) FontDescriptionKey(WTF::HashTableDeletedValue); } 211 211 static bool isDeletedValue(const FontCascadeCacheKey& key) { return key.fontDescriptionKey.isHashTableDeletedValue(); } 212 212 }; -
trunk/Source/WebCore/platform/graphics/IntPointHash.h
r264488 r276502 36 36 static WebCore::IntPoint emptyValue() { return WebCore::IntPoint(0, std::numeric_limits<int>::min()); } 37 37 38 static void constructDeletedValue(WebCore::IntPoint& slot) { slot = WebCore::IntPoint(std::numeric_limits<int>::min(), 0); }39 static bool isDeletedValue(const WebCore::IntPoint& slot) { return slot == WebCore::IntPoint(std::numeric_limits<int>::min(), 0); }38 static void constructDeletedValue(WebCore::IntPoint& slot) { slot.setX(std::numeric_limits<int>::min()); } 39 static bool isDeletedValue(const WebCore::IntPoint& slot) { return slot.x() == std::numeric_limits<int>::min(); } 40 40 }; 41 41 template<> struct DefaultHash<WebCore::IntPoint> : IntPointHash { }; -
trunk/Source/WebCore/rendering/CSSValueKey.h
r264488 r276502 90 90 template<> struct HashTraits<WebCore::CSSValueKey> : GenericHashTraits<WebCore::CSSValueKey> { 91 91 static WebCore::CSSValueKey emptyValue() { return WebCore::CSSValueKey { WebCore::CSSValueInvalid, false, false}; } 92 static void constructDeletedValue(WebCore::CSSValueKey& slot) { slot = WebCore::CSSValueKey { WebCore::CSSValueInvalid, true, true};}92 static void constructDeletedValue(WebCore::CSSValueKey& slot) { new (NotNull, &slot) WebCore::CSSValueKey { WebCore::CSSValueInvalid, true, true}; } 93 93 static bool isDeletedValue(const WebCore::CSSValueKey& slot) { return slot.cssValueID == WebCore::CSSValueInvalid && slot.useDarkAppearance && slot.useElevatedUserInterfaceLevel; } 94 94 }; -
trunk/Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h
r275650 r276502 110 110 static WebCore::ServiceWorkerClientIdentifier emptyValue() { return { }; } 111 111 112 static void constructDeletedValue(WebCore::ServiceWorkerClientIdentifier& slot) { slot.serverConnectionIdentifier = makeObjectIdentifier<WebCore::SWServerConnectionIdentifierType>(std::numeric_limits<uint64_t>::max()); }112 static void constructDeletedValue(WebCore::ServiceWorkerClientIdentifier& slot) { new (NotNull, &slot.serverConnectionIdentifier) WebCore::SWServerConnectionIdentifier(HashTableDeletedValue); } 113 113 114 static bool isDeletedValue(const WebCore::ServiceWorkerClientIdentifier& slot) { return slot.serverConnectionIdentifier. toUInt64() == std::numeric_limits<uint64_t>::max(); }114 static bool isDeletedValue(const WebCore::ServiceWorkerClientIdentifier& slot) { return slot.serverConnectionIdentifier.isHashTableDeletedValue(); } 115 115 }; 116 116 -
trunk/Source/WebKit/ChangeLog
r276497 r276502 1 2021-04-23 Chris Dumez <cdumez@apple.com> 2 3 Improve our constructDeletedValue() template specializations 4 https://bugs.webkit.org/show_bug.cgi?id=224889 5 6 Reviewed by Darin Adler. 7 8 Improve our constructDeletedValue() template specializations and make them more consistent: 9 - Use placement-new instead of object assignment since we don't want/need to destroy the 10 existing object (since it is uninitialized). 11 - Do as little initialization as possible for performance reasons. 12 13 * NetworkProcess/cache/NetworkCache.h: 14 (WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::constructDeletedValue): 15 (WTF::HashTraits<WebKit::NetworkCache::GlobalFrameID>::isDeletedValue): 16 * Platform/IPC/StringReference.h: 17 (WTF::HashTraits<IPC::StringReference>::constructDeletedValue): 18 * Shared/CallbackID.h: 19 (WTF::HashTraits<WebKit::CallbackID>::constructDeletedValue): 20 (WTF::HashTraits<WebKit::CallbackID>::isDeletedValue): 21 1 22 2021-04-23 Youenn Fablet <youenn@apple.com> 2 23 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.h
r275650 r276502 84 84 static WebKit::NetworkCache::GlobalFrameID emptyValue() { return { }; } 85 85 86 static void constructDeletedValue(WebKit::NetworkCache::GlobalFrameID& slot) { slot.webPageID = makeObjectIdentifier<WebCore::PageIdentifierType>(std::numeric_limits<uint64_t>::max()); }87 88 static bool isDeletedValue(const WebKit::NetworkCache::GlobalFrameID& slot) { return slot.webPageID. toUInt64() == std::numeric_limits<uint64_t>::max(); }86 static void constructDeletedValue(WebKit::NetworkCache::GlobalFrameID& slot) { new (NotNull, &slot.webPageID) WebCore::PageIdentifier(WTF::HashTableDeletedValue); } 87 88 static bool isDeletedValue(const WebKit::NetworkCache::GlobalFrameID& slot) { return slot.webPageID.isHashTableDeletedValue(); } 89 89 }; 90 90 -
trunk/Source/WebKit/Platform/IPC/StringReference.h
r264488 r276502 74 74 75 75 private: 76 friend struct HashTraits<IPC::StringReference>; 77 76 78 const char* m_data; 77 79 size_t m_size; … … 102 104 template<> struct HashTraits<IPC::StringReference> : GenericHashTraits<IPC::StringReference> { 103 105 static const bool emptyValueIsZero = 0; 104 static void constructDeletedValue(IPC::StringReference& stringReference) { stringReference = IPC::StringReference(0, std::numeric_limits<size_t>::max()); }106 static void constructDeletedValue(IPC::StringReference& stringReference) { stringReference.m_size = std::numeric_limits<size_t>::max(); } 105 107 static bool isDeletedValue(const IPC::StringReference& stringReference) { return stringReference.size() == std::numeric_limits<size_t>::max(); } 106 108 }; -
trunk/Source/WebKit/Shared/CallbackID.h
r264488 r276502 119 119 template<> struct HashTraits<WebKit::CallbackID> : GenericHashTraits<WebKit::CallbackID> { 120 120 static WebKit::CallbackID emptyValue() { return WebKit::CallbackID(); } 121 static void constructDeletedValue(WebKit::CallbackID& slot) { slot = WebKit::CallbackID(std::numeric_limits<uint64_t>::max()); }122 static bool isDeletedValue(const WebKit::CallbackID& slot) { return slot.m_id == std::numeric_limits<uint64_t>::max(); }121 static void constructDeletedValue(WebKit::CallbackID& slot) { HashTraits<uint64_t>::constructDeletedValue(slot.m_id); } 122 static bool isDeletedValue(const WebKit::CallbackID& slot) { return HashTraits<uint64_t>::isDeletedValue(slot.m_id); } 123 123 }; 124 124 template<> struct DefaultHash<WebKit::CallbackID> : CallbackIDHash { }; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r276247 r276502 1 2021-04-23 Chris Dumez <cdumez@apple.com> 2 3 Improve our constructDeletedValue() template specializations 4 https://bugs.webkit.org/show_bug.cgi?id=224889 5 6 Reviewed by Darin Adler. 7 8 Improve our constructDeletedValue() template specializations and make them more consistent: 9 - Use placement-new instead of object assignment since we don't want/need to destroy the 10 existing object (since it is uninitialized). 11 - Do as little initialization as possible for performance reasons. 12 13 * History/BinaryPropertyList.cpp: 14 (IntegerArray::integers const): 15 (IntegerArray::size const): 16 (IntegerArrayHashTraits::constructDeletedValue): 17 (IntegerArrayHashTraits::isDeletedValue): 18 (IntegerArray::markDeleted): Deleted. 19 (IntegerArray::isDeletedValue const): Deleted. 20 (IntegerArray::deletedValueSize): Deleted. 21 1 22 2021-04-19 Kimmo Kinnunen <kkinnunen@apple.com> 2 23 -
trunk/Source/WebKitLegacy/mac/History/BinaryPropertyList.cpp
r275650 r276502 56 56 IntegerArray(const int* integers, size_t size) : m_integers(integers), m_size(size) { ASSERT(integers); ASSERT(size); } 57 57 58 void markDeleted() { m_integers = 0; m_size = deletedValueSize(); } 59 bool isDeletedValue() const { return m_size == deletedValueSize(); } 58 bool isDeletedValue() const { return HashTraits<size_t>::isDeletedValue(m_size); } 60 59 61 60 const int* integers() const { ASSERT(!isDeletedValue()); return m_integers; } … … 63 62 64 63 private: 65 static size_t deletedValueSize() { return std::numeric_limits<size_t>::max(); } 66 64 friend struct IntegerArrayHashTraits; 67 65 friend bool operator==(const IntegerArray&, const IntegerArray&); 68 66 … … 77 75 78 76 struct IntegerArrayHashTraits : HashTraits<IntegerArray> { 79 static void constructDeletedValue(IntegerArray& slot) { slot.markDeleted(); }80 static bool isDeletedValue(const IntegerArray& array) { return array.isDeletedValue(); }77 static void constructDeletedValue(IntegerArray& slot) { HashTraits<size_t>::constructDeletedValue(slot.m_size); } 78 static bool isDeletedValue(const IntegerArray& slot) { return HashTraits<size_t>::isDeletedValue(slot.m_size); } 81 79 }; 82 80
Note:
See TracChangeset
for help on using the changeset viewer.