Add a "supportedConfiguration" dictionary to MediaCapabilitiesDecodingInfo and MediaC...
[WebKit-https.git] / Source / WebCore / platform / Supplementable.h
index 10e373f..6c2619c 100644 (file)
@@ -28,8 +28,7 @@
 
 #include <wtf/Assertions.h>
 #include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
+#include <wtf/MainThread.h>
 
 #if !ASSERT_DISABLED
 #include <wtf/Threading.h>
@@ -78,14 +77,14 @@ class Supplementable;
 template<typename T>
 class Supplement {
 public:
-    virtual ~Supplement() { }
-#if !ASSERT_DISABLED
+    virtual ~Supplement() = default;
+#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
     virtual bool isRefCountedWrapper() const { return false; }
 #endif
 
-    static void provideTo(Supplementable<T>* host, const char* key, PassOwnPtr<Supplement<T> > supplement)
+    static void provideTo(Supplementable<T>* host, const char* key, std::unique_ptr<Supplement<T>> supplement)
     {
-        host->provideSupplement(key, supplement);
+        host->provideSupplement(key, WTFMove(supplement));
     }
 
     static Supplement<T>* from(Supplementable<T>* host, const char* key)
@@ -97,35 +96,35 @@ public:
 template<typename T>
 class Supplementable {
 public:
-    void provideSupplement(const char* key, PassOwnPtr<Supplement<T> > supplement)
+    void provideSupplement(const char* key, std::unique_ptr<Supplement<T>> supplement)
     {
-        ASSERT(m_threadId == currentThread());
+        ASSERT(canAccessThreadLocalDataForThread(m_thread.get()));
         ASSERT(!m_supplements.get(key));
-        m_supplements.set(key, supplement);
+        m_supplements.set(key, WTFMove(supplement));
     }
 
     void removeSupplement(const char* key)
     {
-        ASSERT(m_threadId == currentThread());
+        ASSERT(canAccessThreadLocalDataForThread(m_thread.get()));
         m_supplements.remove(key);
     }
 
     Supplement<T>* requireSupplement(const char* key)
     {
-        ASSERT(m_threadId == currentThread());
+        ASSERT(canAccessThreadLocalDataForThread(m_thread.get()));
         return m_supplements.get(key);
     }
 
 #if !ASSERT_DISABLED
 protected:
-    Supplementable() : m_threadId(currentThread()) { }
+    Supplementable() = default;
 #endif
 
 private:
-    typedef HashMap<const char*, OwnPtr<Supplement<T> >, PtrHash<const char*> > SupplementMap;
+    typedef HashMap<const char*, std::unique_ptr<Supplement<T>>, PtrHash<const char*>> SupplementMap;
     SupplementMap m_supplements;
 #if !ASSERT_DISABLED
-    ThreadIdentifier m_threadId;
+    Ref<Thread> m_thread { Thread::current() };
 #endif
 };