Use FastAllocator in STL containers
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jul 2017 05:42:33 +0000 (05:42 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jul 2017 05:42:33 +0000 (05:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174366

Rubber stamped by Sam Weinig.

This patch uses FastAllocator for STL containers including std::set and std::map.
STL can take a template parameter to be used as allocator for containers.
We prepare FastAllocator, which uses fastMalloc for allocation.
This allows us to use bmalloc (if supported) for STL containers which offers
functionalities that is not supported in WTF containers.

* Modules/indexeddb/IDBKeyData.h:
* Modules/indexeddb/server/IndexValueEntry.cpp:
(WebCore::IDBServer::IndexValueEntry::IndexValueEntry):
(WebCore::IDBServer::IndexValueEntry::Iterator::Iterator):
(WebCore::IDBServer::IndexValueEntry::reverseFind):
* Modules/indexeddb/server/IndexValueEntry.h:
* Modules/indexeddb/server/IndexValueStore.cpp:
(WebCore::IDBServer::IndexValueStore::lowestIteratorInRange):
(WebCore::IDBServer::IndexValueStore::highestReverseIteratorInRange):
(WebCore::IDBServer::IndexValueStore::Iterator::Iterator):
* Modules/indexeddb/server/IndexValueStore.h:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreCleared):
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::replaceKeyValueStore):
(WebCore::IDBServer::MemoryObjectStore::addRecord):
(WebCore::IDBServer::MemoryObjectStore::updateCursorsForPutRecord):
* Modules/indexeddb/server/MemoryObjectStore.h:
(WebCore::IDBServer::MemoryObjectStore::orderedKeys):
* Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
(WebCore::IDBServer::MemoryObjectStoreCursor::keyAdded):
(WebCore::IDBServer::MemoryObjectStoreCursor::setFirstInRemainingRange):
(WebCore::IDBServer::MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange):
(WebCore::IDBServer::MemoryObjectStoreCursor::setReverseIteratorFromRemainingRange):
(WebCore::IDBServer::MemoryObjectStoreCursor::incrementForwardIterator):
(WebCore::IDBServer::MemoryObjectStoreCursor::incrementReverseIterator):
* Modules/indexeddb/server/MemoryObjectStoreCursor.h:
* Modules/mediasource/SampleMap.h:
* page/WheelEventTestTrigger.cpp:
(WebCore::WheelEventTestTrigger::deferTestsForReason):
(WebCore::dumpState):
* page/WheelEventTestTrigger.h:
* platform/graphics/cv/VideoTextureCopierCV.cpp:
(WebCore::enumToStringMap):
* rendering/OrderIterator.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219383 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKeyData.h
Source/WebCore/Modules/indexeddb/server/IndexValueEntry.cpp
Source/WebCore/Modules/indexeddb/server/IndexValueEntry.h
Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp
Source/WebCore/Modules/indexeddb/server/IndexValueStore.h
Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp
Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h
Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp
Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.h
Source/WebCore/Modules/mediasource/SampleMap.h
Source/WebCore/page/WheelEventTestTrigger.cpp
Source/WebCore/page/WheelEventTestTrigger.h
Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp
Source/WebCore/rendering/OrderIterator.h

index ca3dabb..5c362bc 100644 (file)
@@ -1,3 +1,53 @@
+2017-07-11  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Use FastAllocator in STL containers
+        https://bugs.webkit.org/show_bug.cgi?id=174366
+
+        Rubber stamped by Sam Weinig.
+
+        This patch uses FastAllocator for STL containers including std::set and std::map.
+        STL can take a template parameter to be used as allocator for containers.
+        We prepare FastAllocator, which uses fastMalloc for allocation.
+        This allows us to use bmalloc (if supported) for STL containers which offers
+        functionalities that is not supported in WTF containers.
+
+        * Modules/indexeddb/IDBKeyData.h:
+        * Modules/indexeddb/server/IndexValueEntry.cpp:
+        (WebCore::IDBServer::IndexValueEntry::IndexValueEntry):
+        (WebCore::IDBServer::IndexValueEntry::Iterator::Iterator):
+        (WebCore::IDBServer::IndexValueEntry::reverseFind):
+        * Modules/indexeddb/server/IndexValueEntry.h:
+        * Modules/indexeddb/server/IndexValueStore.cpp:
+        (WebCore::IDBServer::IndexValueStore::lowestIteratorInRange):
+        (WebCore::IDBServer::IndexValueStore::highestReverseIteratorInRange):
+        (WebCore::IDBServer::IndexValueStore::Iterator::Iterator):
+        * Modules/indexeddb/server/IndexValueStore.h:
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreCleared):
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+        * Modules/indexeddb/server/MemoryObjectStore.cpp:
+        (WebCore::IDBServer::MemoryObjectStore::replaceKeyValueStore):
+        (WebCore::IDBServer::MemoryObjectStore::addRecord):
+        (WebCore::IDBServer::MemoryObjectStore::updateCursorsForPutRecord):
+        * Modules/indexeddb/server/MemoryObjectStore.h:
+        (WebCore::IDBServer::MemoryObjectStore::orderedKeys):
+        * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
+        (WebCore::IDBServer::MemoryObjectStoreCursor::keyAdded):
+        (WebCore::IDBServer::MemoryObjectStoreCursor::setFirstInRemainingRange):
+        (WebCore::IDBServer::MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange):
+        (WebCore::IDBServer::MemoryObjectStoreCursor::setReverseIteratorFromRemainingRange):
+        (WebCore::IDBServer::MemoryObjectStoreCursor::incrementForwardIterator):
+        (WebCore::IDBServer::MemoryObjectStoreCursor::incrementReverseIterator):
+        * Modules/indexeddb/server/MemoryObjectStoreCursor.h:
+        * Modules/mediasource/SampleMap.h:
+        * page/WheelEventTestTrigger.cpp:
+        (WebCore::WheelEventTestTrigger::deferTestsForReason):
+        (WebCore::dumpState):
+        * page/WheelEventTestTrigger.h:
+        * platform/graphics/cv/VideoTextureCopierCV.cpp:
+        (WebCore::enumToStringMap):
+        * rendering/OrderIterator.h:
+
 2017-07-11  Per Arne Vollan  <pvollan@apple.com>
 
         [Win] Build error when building WebKit.dll from WebKit.proj project file.
index 98f0b73..fcc1688 100644 (file)
@@ -28,6 +28,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "IDBKey.h"
+#include <set>
 #include <wtf/Variant.h>
 #include <wtf/text/StringHash.h>
 
@@ -299,6 +300,8 @@ bool IDBKeyData::decode(Decoder& decoder, IDBKeyData& keyData)
     return true;
 }
 
+using IDBKeyDataSet = std::set<IDBKeyData, std::less<IDBKeyData>, FastAllocator<IDBKeyData>>;
+
 } // namespace WebCore
 
 #endif // ENABLE(INDEXED_DATABASE)
index 38c8606..6ab8fa2 100644 (file)
@@ -39,7 +39,7 @@ IndexValueEntry::IndexValueEntry(bool unique)
     if (m_unique)
         m_key = nullptr;
     else
-        m_orderedKeys = new std::set<IDBKeyData>;
+        m_orderedKeys = new IDBKeyDataSet;
 }
 
 IndexValueEntry::~IndexValueEntry()
@@ -101,13 +101,13 @@ IndexValueEntry::Iterator::Iterator(IndexValueEntry& entry)
     ASSERT(m_entry->m_key);
 }
 
-IndexValueEntry::Iterator::Iterator(IndexValueEntry& entry, std::set<IDBKeyData>::iterator iterator)
+IndexValueEntry::Iterator::Iterator(IndexValueEntry& entry, IDBKeyDataSet::iterator iterator)
     : m_entry(&entry)
     , m_forwardIterator(iterator)
 {
 }
 
-IndexValueEntry::Iterator::Iterator(IndexValueEntry& entry, std::set<IDBKeyData>::reverse_iterator iterator)
+IndexValueEntry::Iterator::Iterator(IndexValueEntry& entry, IDBKeyDataSet::reverse_iterator iterator)
     : m_entry(&entry)
     , m_forward(false)
     , m_reverseIterator(iterator)
@@ -218,7 +218,7 @@ IndexValueEntry::Iterator IndexValueEntry::reverseFind(const IDBKeyData& key, Cu
     }
 
     ASSERT(m_orderedKeys);
-    auto iterator = std::set<IDBKeyData>::reverse_iterator(m_orderedKeys->upper_bound(key));
+    auto iterator = IDBKeyDataSet::reverse_iterator(m_orderedKeys->upper_bound(key));
     if (iterator == m_orderedKeys->rend())
         return { };
 
index df0543f..ab350af 100644 (file)
@@ -28,7 +28,6 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "IDBKeyData.h"
-#include <set>
 
 namespace WebCore {
 
@@ -59,8 +58,8 @@ public:
         }
 
         Iterator(IndexValueEntry&);
-        Iterator(IndexValueEntry&, std::set<IDBKeyData>::iterator);
-        Iterator(IndexValueEntry&, std::set<IDBKeyData>::reverse_iterator);
+        Iterator(IndexValueEntry&, IDBKeyDataSet::iterator);
+        Iterator(IndexValueEntry&, IDBKeyDataSet::reverse_iterator);
 
         bool isValid() const;
         void invalidate();
@@ -73,8 +72,8 @@ public:
     private:
         IndexValueEntry* m_entry { nullptr };
         bool m_forward { true };
-        std::set<IDBKeyData>::iterator m_forwardIterator;
-        std::set<IDBKeyData>::reverse_iterator m_reverseIterator;
+        IDBKeyDataSet::iterator m_forwardIterator;
+        IDBKeyDataSet::reverse_iterator m_reverseIterator;
     };
 
     Iterator begin();
@@ -89,7 +88,7 @@ public:
 
 private:
     union {
-        std::set<IDBKeyData>* m_orderedKeys;
+        IDBKeyDataSet* m_orderedKeys;
         IDBKeyData* m_key;
     };
 
index 3398884..3990c05 100644 (file)
@@ -142,7 +142,7 @@ IDBKeyData IndexValueStore::lowestKeyWithRecordInRange(const IDBKeyRangeData& ra
     return *iterator;
 }
 
-std::set<IDBKeyData>::iterator IndexValueStore::lowestIteratorInRange(const IDBKeyRangeData& range) const
+IDBKeyDataSet::iterator IndexValueStore::lowestIteratorInRange(const IDBKeyRangeData& range) const
 {
     auto lowestInRange = m_orderedKeys.lower_bound(range.lowerKey);
 
@@ -166,9 +166,9 @@ std::set<IDBKeyData>::iterator IndexValueStore::lowestIteratorInRange(const IDBK
     return lowestInRange;
 }
 
-std::set<IDBKeyData>::reverse_iterator IndexValueStore::highestReverseIteratorInRange(const IDBKeyRangeData& range) const
+IDBKeyDataSet::reverse_iterator IndexValueStore::highestReverseIteratorInRange(const IDBKeyRangeData& range) const
 {
-    auto highestInRange = std::set<IDBKeyData>::reverse_iterator(m_orderedKeys.upper_bound(range.upperKey));
+    auto highestInRange = IDBKeyDataSet::reverse_iterator(m_orderedKeys.upper_bound(range.upperKey));
 
     if (highestInRange == m_orderedKeys.rend())
         return highestInRange;
@@ -312,14 +312,14 @@ IndexValueStore::Iterator IndexValueStore::reverseFind(const IDBKeyData& key, co
 }
 
 
-IndexValueStore::Iterator::Iterator(IndexValueStore& store, std::set<IDBKeyData>::iterator iterator, IndexValueEntry::Iterator primaryIterator)
+IndexValueStore::Iterator::Iterator(IndexValueStore& store, IDBKeyDataSet::iterator iterator, IndexValueEntry::Iterator primaryIterator)
     : m_store(&store)
     , m_forwardIterator(iterator)
     , m_primaryKeyIterator(primaryIterator)
 {
 }
 
-IndexValueStore::Iterator::Iterator(IndexValueStore& store, CursorDuplicity duplicity, std::set<IDBKeyData>::reverse_iterator iterator, IndexValueEntry::Iterator primaryIterator)
+IndexValueStore::Iterator::Iterator(IndexValueStore& store, CursorDuplicity duplicity, IDBKeyDataSet::reverse_iterator iterator, IndexValueEntry::Iterator primaryIterator)
     : m_store(&store)
     , m_forward(false)
     , m_duplicity(duplicity)
index 3af7c1f..86a1da5 100644 (file)
@@ -30,7 +30,6 @@
 #include "IDBCursorInfo.h"
 #include "IDBKeyData.h"
 #include "IndexValueEntry.h"
-#include <set>
 #include <wtf/HashMap.h>
 
 namespace WebCore {
@@ -67,8 +66,8 @@ public:
         {
         }
 
-        Iterator(IndexValueStore&, std::set<IDBKeyData>::iterator, IndexValueEntry::Iterator);
-        Iterator(IndexValueStore&, CursorDuplicity, std::set<IDBKeyData>::reverse_iterator, IndexValueEntry::Iterator);
+        Iterator(IndexValueStore&, IDBKeyDataSet::iterator, IndexValueEntry::Iterator);
+        Iterator(IndexValueStore&, CursorDuplicity, IDBKeyDataSet::reverse_iterator, IndexValueEntry::Iterator);
 
         void invalidate();
         bool isValid();
@@ -84,8 +83,8 @@ public:
         IndexValueStore* m_store { nullptr };
         bool m_forward { true };
         CursorDuplicity m_duplicity { CursorDuplicity::Duplicates };
-        std::set<IDBKeyData>::iterator m_forwardIterator;
-        std::set<IDBKeyData>::reverse_iterator m_reverseIterator;
+        IDBKeyDataSet::iterator m_forwardIterator;
+        IDBKeyDataSet::reverse_iterator m_reverseIterator;
 
         IndexValueEntry::Iterator m_primaryKeyIterator;
     };
@@ -103,11 +102,11 @@ public:
 #endif
 
 private:
-    std::set<IDBKeyData>::iterator lowestIteratorInRange(const IDBKeyRangeData&) const;
-    std::set<IDBKeyData>::reverse_iterator highestReverseIteratorInRange(const IDBKeyRangeData&) const;
+    IDBKeyDataSet::iterator lowestIteratorInRange(const IDBKeyRangeData&) const;
+    IDBKeyDataSet::reverse_iterator highestReverseIteratorInRange(const IDBKeyRangeData&) const;
 
     IndexKeyValueMap m_records;
-    std::set<IDBKeyData> m_orderedKeys;
+    IDBKeyDataSet m_orderedKeys;
     
     bool m_unique;
 };
index 0e7bb6b..1ea5cb1 100644 (file)
@@ -134,7 +134,7 @@ void MemoryBackingStoreTransaction::objectStoreDeleted(Ref<MemoryObjectStore>&&
         addResult.iterator->value = WTFMove(objectStore);
 }
 
-void MemoryBackingStoreTransaction::objectStoreCleared(MemoryObjectStore& objectStore, std::unique_ptr<KeyValueMap>&& keyValueMap, std::unique_ptr<std::set<IDBKeyData>>&& orderedKeys)
+void MemoryBackingStoreTransaction::objectStoreCleared(MemoryObjectStore& objectStore, std::unique_ptr<KeyValueMap>&& keyValueMap, std::unique_ptr<IDBKeyDataSet>&& orderedKeys)
 {
     ASSERT(m_objectStores.contains(&objectStore));
 
index 5ac9302..4ea2d32 100644 (file)
@@ -62,7 +62,7 @@ public:
     
     void recordValueChanged(MemoryObjectStore&, const IDBKeyData&, ThreadSafeDataBuffer*);
     void objectStoreDeleted(Ref<MemoryObjectStore>&&);
-    void objectStoreCleared(MemoryObjectStore&, std::unique_ptr<KeyValueMap>&&, std::unique_ptr<std::set<IDBKeyData>>&&);
+    void objectStoreCleared(MemoryObjectStore&, std::unique_ptr<KeyValueMap>&&, std::unique_ptr<IDBKeyDataSet>&&);
     void objectStoreRenamed(MemoryObjectStore&, const String& oldName);
     void indexRenamed(MemoryIndex&, const String& oldName);
     void indexCleared(MemoryIndex&, std::unique_ptr<IndexValueStore>&&);
@@ -95,7 +95,7 @@ private:
     HashMap<String, RefPtr<MemoryIndex>> m_deletedIndexes;
     HashMap<MemoryObjectStore*, std::unique_ptr<KeyValueMap>> m_originalValues;
     HashMap<MemoryObjectStore*, std::unique_ptr<KeyValueMap>> m_clearedKeyValueMaps;
-    HashMap<MemoryObjectStore*, std::unique_ptr<std::set<IDBKeyData>>> m_clearedOrderedKeys;
+    HashMap<MemoryObjectStore*, std::unique_ptr<IDBKeyDataSet>> m_clearedOrderedKeys;
     HashMap<MemoryObjectStore*, String> m_originalObjectStoreNames;
     HashMap<MemoryIndex*, String> m_originalIndexNames;
     HashMap<MemoryIndex*, std::unique_ptr<IndexValueStore>> m_clearedIndexValueStores;
index 34b4e12..05660e2 100644 (file)
@@ -191,7 +191,7 @@ void MemoryObjectStore::clear()
         cursor->objectStoreCleared();
 }
 
-void MemoryObjectStore::replaceKeyValueStore(std::unique_ptr<KeyValueMap>&& store, std::unique_ptr<std::set<IDBKeyData>>&& orderedKeys)
+void MemoryObjectStore::replaceKeyValueStore(std::unique_ptr<KeyValueMap>&& store, std::unique_ptr<IDBKeyDataSet>&& orderedKeys)
 {
     ASSERT(m_writeTransaction);
     ASSERT(m_writeTransaction->isAborting());
@@ -263,7 +263,7 @@ IDBError MemoryObjectStore::addRecord(MemoryBackingStoreTransaction& transaction
     if (!m_keyValueStore) {
         ASSERT(!m_orderedKeys);
         m_keyValueStore = std::make_unique<KeyValueMap>();
-        m_orderedKeys = std::make_unique<std::set<IDBKeyData>>();
+        m_orderedKeys = std::make_unique<IDBKeyDataSet>();
     }
 
     auto mapResult = m_keyValueStore->set(keyData, value.data());
@@ -282,7 +282,7 @@ IDBError MemoryObjectStore::addRecord(MemoryBackingStoreTransaction& transaction
     return error;
 }
 
-void MemoryObjectStore::updateCursorsForPutRecord(std::set<IDBKeyData>::iterator iterator)
+void MemoryObjectStore::updateCursorsForPutRecord(IDBKeyDataSet::iterator iterator)
 {
     for (auto& cursor : m_cursors.values())
         cursor->keyAdded(iterator);
index 883959e..5b3d833 100644 (file)
@@ -32,7 +32,6 @@
 #include "MemoryIndex.h"
 #include "MemoryObjectStoreCursor.h"
 #include "ThreadSafeDataBuffer.h"
-#include <set>
 #include <wtf/HashMap.h>
 #include <wtf/RefCounted.h>
 
@@ -81,7 +80,7 @@ public:
     void setKeyGeneratorValue(uint64_t value) { m_keyGeneratorValue = value; }
 
     void clear();
-    void replaceKeyValueStore(std::unique_ptr<KeyValueMap>&&, std::unique_ptr<std::set<IDBKeyData>>&&);
+    void replaceKeyValueStore(std::unique_ptr<KeyValueMap>&&, std::unique_ptr<IDBKeyDataSet>&&);
 
     ThreadSafeDataBuffer valueForKey(const IDBKeyData&) const;
     ThreadSafeDataBuffer valueForKeyRange(const IDBKeyRangeData&) const;
@@ -95,7 +94,7 @@ public:
 
     MemoryObjectStoreCursor* maybeOpenCursor(const IDBCursorInfo&);
 
-    std::set<IDBKeyData>* orderedKeys() { return m_orderedKeys.get(); }
+    IDBKeyDataSet* orderedKeys() { return m_orderedKeys.get(); }
 
     MemoryIndex* indexForIdentifier(uint64_t);
 
@@ -107,12 +106,12 @@ public:
 private:
     MemoryObjectStore(const IDBObjectStoreInfo&);
 
-    std::set<IDBKeyData>::iterator lowestIteratorInRange(const IDBKeyRangeData&, bool reverse) const;
+    IDBKeyDataSet::iterator lowestIteratorInRange(const IDBKeyRangeData&, bool reverse) const;
 
     IDBError populateIndexWithExistingRecords(MemoryIndex&);
     IDBError updateIndexesForPutRecord(const IDBKeyData&, const ThreadSafeDataBuffer& value);
     void updateIndexesForDeleteRecord(const IDBKeyData& value);
-    void updateCursorsForPutRecord(std::set<IDBKeyData>::iterator);
+    void updateCursorsForPutRecord(IDBKeyDataSet::iterator);
     void updateCursorsForDeleteRecord(const IDBKeyData&);
 
     RefPtr<MemoryIndex> takeIndexByIdentifier(uint64_t indexIdentifier);
@@ -123,7 +122,7 @@ private:
     uint64_t m_keyGeneratorValue { 1 };
 
     std::unique_ptr<KeyValueMap> m_keyValueStore;
-    std::unique_ptr<std::set<IDBKeyData>> m_orderedKeys;
+    std::unique_ptr<IDBKeyDataSet> m_orderedKeys;
 
     void unregisterIndex(MemoryIndex&);
     HashMap<uint64_t, RefPtr<MemoryIndex>> m_indexesByIdentifier;
index d95efe6..381d20e 100644 (file)
@@ -62,7 +62,7 @@ void MemoryObjectStoreCursor::keyDeleted(const IDBKeyData& key)
     m_iterator = std::nullopt;
 }
 
-void MemoryObjectStoreCursor::keyAdded(std::set<IDBKeyData>::iterator iterator)
+void MemoryObjectStoreCursor::keyAdded(IDBKeyDataSet::iterator iterator)
 {
     if (m_iterator)
         return;
@@ -71,7 +71,7 @@ void MemoryObjectStoreCursor::keyAdded(std::set<IDBKeyData>::iterator iterator)
         m_iterator = iterator;
 }
 
-void MemoryObjectStoreCursor::setFirstInRemainingRange(std::set<IDBKeyData>& set)
+void MemoryObjectStoreCursor::setFirstInRemainingRange(IDBKeyDataSet& set)
 {
     m_iterator = std::nullopt;
 
@@ -92,7 +92,7 @@ void MemoryObjectStoreCursor::setFirstInRemainingRange(std::set<IDBKeyData>& set
     ASSERT(!m_iterator || *m_iterator != set.end());
 }
 
-void MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange(std::set<IDBKeyData>& set)
+void MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange(IDBKeyDataSet& set)
 {
     if (!set.size()) {
         m_iterator = std::nullopt;
@@ -130,7 +130,7 @@ void MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange(std::set<IDBK
     m_iterator = lowest;
 }
 
-void MemoryObjectStoreCursor::setReverseIteratorFromRemainingRange(std::set<IDBKeyData>& set)
+void MemoryObjectStoreCursor::setReverseIteratorFromRemainingRange(IDBKeyDataSet& set)
 {
     if (!set.size()) {
         m_iterator = std::nullopt;
@@ -198,7 +198,7 @@ void MemoryObjectStoreCursor::currentData(IDBGetResult& data)
     }
 }
 
-void MemoryObjectStoreCursor::incrementForwardIterator(std::set<IDBKeyData>& set, const IDBKeyData& key, uint32_t count)
+void MemoryObjectStoreCursor::incrementForwardIterator(IDBKeyDataSet& set, const IDBKeyData& key, uint32_t count)
 {
     // We might need to re-grab the current iterator.
     // e.g. If the record it was pointed to had been deleted.
@@ -254,7 +254,7 @@ void MemoryObjectStoreCursor::incrementForwardIterator(std::set<IDBKeyData>& set
     }
 }
 
-void MemoryObjectStoreCursor::incrementReverseIterator(std::set<IDBKeyData>& set, const IDBKeyData& key, uint32_t count)
+void MemoryObjectStoreCursor::incrementReverseIterator(IDBKeyDataSet& set, const IDBKeyData& key, uint32_t count)
 {
     // We might need to re-grab the current iterator.
     // e.g. If the record it was pointed to had been deleted.
index 633f1e6..42d162f 100644 (file)
@@ -30,7 +30,6 @@
 #include "IDBCursorInfo.h"
 #include "IDBKeyData.h"
 #include "MemoryCursor.h"
-#include <set>
 #include <wtf/Optional.h>
 
 namespace WebCore {
@@ -44,18 +43,18 @@ public:
 
     void objectStoreCleared();
     void keyDeleted(const IDBKeyData&);
-    void keyAdded(std::set<IDBKeyData>::iterator);
+    void keyAdded(IDBKeyDataSet::iterator);
 
 private:
     void currentData(IDBGetResult&) final;
     void iterate(const IDBKeyData&, const IDBKeyData& primaryKey, uint32_t count, IDBGetResult&) final;
 
-    void setFirstInRemainingRange(std::set<IDBKeyData>&);
-    void setForwardIteratorFromRemainingRange(std::set<IDBKeyData>&);
-    void setReverseIteratorFromRemainingRange(std::set<IDBKeyData>&);
+    void setFirstInRemainingRange(IDBKeyDataSet&);
+    void setForwardIteratorFromRemainingRange(IDBKeyDataSet&);
+    void setReverseIteratorFromRemainingRange(IDBKeyDataSet&);
 
-    void incrementForwardIterator(std::set<IDBKeyData>&, const IDBKeyData&, uint32_t count);
-    void incrementReverseIterator(std::set<IDBKeyData>&, const IDBKeyData&, uint32_t count);
+    void incrementForwardIterator(IDBKeyDataSet&, const IDBKeyData&, uint32_t count);
+    void incrementReverseIterator(IDBKeyDataSet&, const IDBKeyData&, uint32_t count);
 
     bool hasValidPosition() const;
 
@@ -63,7 +62,7 @@ private:
 
     IDBKeyRangeData m_remainingRange;
 
-    std::optional<std::set<IDBKeyData>::iterator> m_iterator;
+    std::optional<IDBKeyDataSet::iterator> m_iterator;
 
     IDBKeyData m_currentPositionKey;
 };
index 639797a..d7ce03f 100644 (file)
@@ -39,7 +39,7 @@ class SampleMap;
 class PresentationOrderSampleMap {
     friend class SampleMap;
 public:
-    typedef std::map<MediaTime, RefPtr<MediaSample>> MapType;
+    using MapType = std::map<MediaTime, RefPtr<MediaSample>, std::less<MediaTime>, FastAllocator<std::pair<const MediaTime, RefPtr<MediaSample>>>>;
     typedef MapType::iterator iterator;
     typedef MapType::const_iterator const_iterator;
     typedef MapType::reverse_iterator reverse_iterator;
@@ -72,7 +72,7 @@ class DecodeOrderSampleMap {
     friend class SampleMap;
 public:
     typedef std::pair<MediaTime, MediaTime> KeyType;
-    typedef std::map<KeyType, RefPtr<MediaSample>> MapType;
+    using MapType = std::map<KeyType, RefPtr<MediaSample>, std::less<KeyType>, FastAllocator<std::pair<const KeyType, RefPtr<MediaSample>>>>;
     typedef MapType::iterator iterator;
     typedef MapType::const_iterator const_iterator;
     typedef MapType::reverse_iterator reverse_iterator;
index 90217a8..ed549cf 100644 (file)
@@ -68,7 +68,7 @@ void WheelEventTestTrigger::deferTestsForReason(ScrollableAreaIdentifier identif
     std::lock_guard<Lock> lock(m_testTriggerMutex);
     auto it = m_deferTestTriggerReasons.find(identifier);
     if (it == m_deferTestTriggerReasons.end())
-        it = m_deferTestTriggerReasons.add(identifier, std::set<DeferTestTriggerReason>()).iterator;
+        it = m_deferTestTriggerReasons.add(identifier, DeferTestTriggerReasonSet()).iterator;
     
     LOG(WheelEventTestTriggers, "      (=) WheelEventTestTrigger::deferTestsForReason: id=%p, reason=%d", identifier, reason);
     it->value.insert(reason);
@@ -89,7 +89,7 @@ void WheelEventTestTrigger::removeTestDeferralForReason(ScrollableAreaIdentifier
 }
 
 #if !LOG_DISABLED
-static void dumpState(WTF::HashMap<WheelEventTestTrigger::ScrollableAreaIdentifier, std::set<WheelEventTestTrigger::DeferTestTriggerReason>> reasons)
+static void dumpState(WTF::HashMap<WheelEventTestTrigger::ScrollableAreaIdentifier, WheelEventTestTrigger::DeferTestTriggerReasonSet> reasons)
 {
     LOG(WheelEventTestTriggers, "   WheelEventTestTrigger::dumpState:");
     for (const auto& scrollRegion : reasons) {
index 50ed33c..d1079d4 100644 (file)
@@ -52,6 +52,7 @@ public:
         ScrollingThreadSyncNeeded,
         ContentScrollInProgress
     };
+    using DeferTestTriggerReasonSet = std::set<DeferTestTriggerReason, std::less<DeferTestTriggerReason>, FastAllocator<DeferTestTriggerReason>>;
     typedef const void* ScrollableAreaIdentifier;
     void WEBCORE_EXPORT deferTestsForReason(ScrollableAreaIdentifier, DeferTestTriggerReason);
     void WEBCORE_EXPORT removeTestDeferralForReason(ScrollableAreaIdentifier, DeferTestTriggerReason);
@@ -61,7 +62,7 @@ private:
     WTF::Function<void()> m_testNotificationCallback;
     RunLoop::Timer<WheelEventTestTrigger> m_testTriggerTimer;
     mutable Lock m_testTriggerMutex;
-    WTF::HashMap<ScrollableAreaIdentifier, std::set<DeferTestTriggerReason>> m_deferTestTriggerReasons;
+    WTF::HashMap<ScrollableAreaIdentifier, DeferTestTriggerReasonSet> m_deferTestTriggerReasons;
 };
 
 } // namespace WebCore
index 1d1ea39..9bc37b3 100644 (file)
@@ -49,13 +49,13 @@ VideoTextureCopierCV::~VideoTextureCopierCV()
 }
 
 #if !LOG_DISABLED
-
+using StringMap = std::map<uint32_t, const char*, std::less<uint32_t>, FastAllocator<std::pair<const uint32_t, const char*>>>;
 #define STRINGIFY_PAIR(e) e, #e
-static std::map<uint32_t, const char*>& enumToStringMap()
+static StringMap& enumToStringMap()
 {
-    static NeverDestroyed<std::map<uint32_t, const char*>> map;
+    static NeverDestroyed<StringMap> map;
     if (map.get().empty()) {
-        std::map<uint32_t, const char*> stringMap;
+        StringMap stringMap;
         map.get().emplace(STRINGIFY_PAIR(GL_RGB));
         map.get().emplace(STRINGIFY_PAIR(GL_RGBA));
         map.get().emplace(STRINGIFY_PAIR(GL_LUMINANCE_ALPHA));
index dfa7793..d4957b7 100644 (file)
@@ -56,7 +56,7 @@ private:
     RenderBox& m_containerBox;
     RenderBox* m_currentChild;
 
-    typedef std::set<int> OrderValues;
+    using OrderValues = std::set<int, std::less<int>, FastAllocator<int>>;
     OrderValues m_orderValues;
     OrderValues::const_iterator m_orderValuesIterator;
     bool m_isReset { false };