Diff
Modified: trunk/Source/WTF/ChangeLog (261817 => 261818)
--- trunk/Source/WTF/ChangeLog 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Source/WTF/ChangeLog 2020-05-18 17:16:16 UTC (rev 261818)
@@ -1,3 +1,32 @@
+2020-05-18 Darin Adler <[email protected]>
+
+ Add iterator checking to ListHashSet
+ https://bugs.webkit.org/show_bug.cgi?id=211669
+
+ Reviewed by Anders Carlsson.
+
+ HashSet and HashMap have iterator checking in debug builds.
+ Add similar checking to ListHashSet, controlled by the same
+ macro, CHECK_HASHTABLE_ITERATORS. Use WeakPtr to make the
+ implementation simple.
+
+ * wtf/Forward.h: Update to add a second parameter to WeakPtr.
+ Also rearranged and tweaked the file a bug.
+
+ * wtf/ListHashSet.h: Make ListHashSet and ListHashSetNode derive
+ from CanMakeWeakPtr. Add m_weakSet and m_weakPosition members to
+ ListHashSetConstIterator, and assert their values at the appropriate
+ times so we will get a breakpoint or crash.
+
+ * wtf/WeakHashSet.h: Updated to add a Counter argument for testing.
+
+ * wtf/WeakPtr.h: Removed the DID_CREATE_WEAK_PTR_IMPL and
+ WILL_DESTROY_WEAK_PTR_IMPL macros, which didn't really work because
+ using them violated the C++ one-definition rule. Replaced with
+ a Counter argument, which defaults to EmptyCounter, which is inlines
+ that do nothing. This required some updates to the classes and
+ functions to make them work with a second argument.
+
2020-05-15 Alex Christensen <[email protected]>
Make host parser fail on ^
Modified: trunk/Source/WTF/wtf/Forward.h (261817 => 261818)
--- trunk/Source/WTF/wtf/Forward.h 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Source/WTF/wtf/Forward.h 2020-05-18 17:16:16 UTC (rev 261818)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -47,7 +47,11 @@
class URL;
class WallTime;
+struct AnyThreadsAccessTraits;
+struct EmptyCounter;
struct FastMalloc;
+struct MainThreadAccessTraits;
+
#if ENABLE(MALLOC_HEAP_BREAKDOWN)
struct VectorMalloc;
#else
@@ -54,41 +58,35 @@
using VectorMalloc = FastMalloc;
#endif
-struct AnyThreadsAccessTraits;
-struct MainThreadAccessTraits;
+template<typename> struct DumbPtrTraits;
+
template<typename> class CompletionHandler;
-template<typename T> struct DumbPtrTraits;
-template<typename T> struct DumbValueTraits;
template<typename> class Function;
template<typename, typename = AnyThreadsAccessTraits> class LazyNeverDestroyed;
template<typename, typename = AnyThreadsAccessTraits> class NeverDestroyed;
template<typename> class OptionSet;
template<typename> class Optional;
-template<typename T> class Packed;
+template<typename> class Packed;
template<typename T, size_t = alignof(T)> class PackedAlignedPtr;
template<typename T, typename = DumbPtrTraits<T>> class Ref;
template<typename T, typename = DumbPtrTraits<T>> class RefPtr;
template<typename> class StringBuffer;
template<typename, typename = void> class StringTypeAdapter;
-template<typename T> class UniqueRef;
-template<typename T> class WeakPtr;
+template<typename> class UniqueRef;
+template<typename...> class Variant;
+template<typename, size_t = 0, typename = CrashOnOverflow, size_t = 16, typename Malloc = VectorMalloc> class Vector;
+template<typename, typename = EmptyCounter> class WeakPtr;
template<typename> struct DefaultHash { using Hash = void; };
-template<typename> struct HashTraits;
-
+template<typename> struct DumbValueTraits;
template<typename> struct EnumTraits;
template<typename E, E...> struct EnumValues;
+template<typename> struct HashTraits;
-template<typename...> class Variant;
-template<typename, size_t = 0, typename = CrashOnOverflow, size_t = 16, typename Malloc = VectorMalloc> class Vector;
template<typename Value, typename = typename DefaultHash<Value>::Hash, typename = HashTraits<Value>> class HashCountedSet;
template<typename KeyArg, typename MappedArg, typename = typename DefaultHash<KeyArg>::Hash, typename = HashTraits<KeyArg>, typename = HashTraits<MappedArg>> class HashMap;
template<typename ValueArg, typename = typename DefaultHash<ValueArg>::Hash, typename = HashTraits<ValueArg>> class HashSet;
-template<size_t, typename> struct variant_alternative;
-template<ptrdiff_t, typename...> struct __indexed_type;
-template<ptrdiff_t _Index, typename... _Types> constexpr typename __indexed_type<_Index, _Types...>::__type const& get(Variant<_Types...> const&);
-
}
namespace std {
Modified: trunk/Source/WTF/wtf/ListHashSet.h (261817 => 261818)
--- trunk/Source/WTF/wtf/ListHashSet.h 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Source/WTF/wtf/ListHashSet.h 2020-05-18 17:16:16 UTC (rev 261818)
@@ -23,6 +23,10 @@
#include <wtf/HashSet.h>
+#if CHECK_HASHTABLE_ITERATORS
+#include <wtf/WeakPtr.h>
+#endif
+
namespace WTF {
// ListHashSet: Just like HashSet, this class provides a Set
@@ -45,7 +49,11 @@
template<typename HashArg> struct ListHashSetNodeHashFunctions;
template<typename HashArg> struct ListHashSetTranslator;
-template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet final {
+template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet final
+#if CHECK_HASHTABLE_ITERATORS
+ : public CanMakeWeakPtr<ListHashSet<ValueArg, HashArg>, WeakPtrFactoryInitialization::Eager>
+#endif
+{
WTF_MAKE_FAST_ALLOCATED;
private:
typedef ListHashSetNode<ValueArg> Node;
@@ -164,11 +172,14 @@
Node* m_tail { nullptr };
};
-template<typename ValueArg> struct ListHashSetNode {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- template<typename T>
- ListHashSetNode(T&& value)
+template<typename ValueArg> struct ListHashSetNode
+#if CHECK_HASHTABLE_ITERATORS
+ : CanMakeWeakPtr<ListHashSetNode<ValueArg>, WeakPtrFactoryInitialization::Eager>
+#endif
+{
+ WTF_MAKE_STRUCT_FAST_ALLOCATED;
+
+ template<typename T> ListHashSetNode(T&& value)
: m_value(std::forward<T>(value))
{
}
@@ -247,6 +258,10 @@
ListHashSetConstIterator(const ListHashSetType* set, Node* position)
: m_set(set)
, m_position(position)
+#if CHECK_HASHTABLE_ITERATORS
+ , m_weakSet(makeWeakPtr(set))
+ , m_weakPosition(makeWeakPtr(position))
+#endif
{
}
@@ -263,6 +278,9 @@
const ValueType* get() const
{
+#if CHECK_HASHTABLE_ITERATORS
+ ASSERT(m_weakPosition);
+#endif
return std::addressof(m_position->m_value);
}
@@ -271,8 +289,14 @@
const_iterator& operator++()
{
+#if CHECK_HASHTABLE_ITERATORS
+ ASSERT(m_weakPosition);
+#endif
ASSERT(m_position);
m_position = m_position->m_next;
+#if CHECK_HASHTABLE_ITERATORS
+ m_weakPosition = makeWeakPtr(m_position);
+#endif
return *this;
}
@@ -280,11 +304,18 @@
const_iterator& operator--()
{
+#if CHECK_HASHTABLE_ITERATORS
+ ASSERT(m_weakSet);
+ m_weakPosition.get();
+#endif
ASSERT(m_position != m_set->m_head);
if (!m_position)
m_position = m_set->m_tail;
else
m_position = m_position->m_prev;
+#if CHECK_HASHTABLE_ITERATORS
+ m_weakPosition = makeWeakPtr(m_position);
+#endif
return *this;
}
@@ -303,8 +334,12 @@
private:
Node* node() { return m_position; }
- const ListHashSetType* m_set;
- Node* m_position;
+ const ListHashSetType* m_set { nullptr };
+ Node* m_position { nullptr };
+#if CHECK_HASHTABLE_ITERATORS
+ WeakPtr<const ListHashSetType> m_weakSet;
+ WeakPtr<Node> m_weakPosition;
+#endif
};
template<typename HashFunctions>
Modified: trunk/Source/WTF/wtf/WeakHashSet.h (261817 => 261818)
--- trunk/Source/WTF/wtf/WeakHashSet.h 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Source/WTF/wtf/WeakHashSet.h 2020-05-18 17:16:16 UTC (rev 261818)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,24 +27,23 @@
#include <wtf/Algorithms.h>
#include <wtf/HashSet.h>
-#include <wtf/HashTraits.h>
#include <wtf/WeakPtr.h>
namespace WTF {
-template<> struct HashTraits<Ref<WeakPtrImpl>> : RefHashTraits<WeakPtrImpl> {
+template<typename Counter> struct HashTraits<Ref<WeakPtrImpl<Counter>>> : RefHashTraits<WeakPtrImpl<Counter>> {
static constexpr bool hasIsReleasedWeakValueFunction = true;
- static bool isReleasedWeakValue(const Ref<WeakPtrImpl>& value)
+ static bool isReleasedWeakValue(const Ref<WeakPtrImpl<Counter>>& value)
{
return !value.isHashTableDeletedValue() && !value.isHashTableEmptyValue() && !value.get();
}
};
-template <typename T>
+template<typename T, typename Counter = EmptyCounter>
class WeakHashSet final {
WTF_MAKE_FAST_ALLOCATED;
public:
- typedef HashSet<Ref<WeakPtrImpl>> WeakPtrImplSet;
+ typedef HashSet<Ref<WeakPtrImpl<Counter>>> WeakPtrImplSet;
typedef typename WeakPtrImplSet::AddResult AddResult;
class WeakHashSetConstIterator : public std::iterator<std::forward_iterator_tag, T, std::ptrdiff_t, const T*, const T&> {
@@ -85,7 +84,7 @@
}
private:
- template <typename> friend class WeakHashSet;
+ template <typename, typename> friend class WeakHashSet;
typename WeakPtrImplSet::const_iterator m_position;
typename WeakPtrImplSet::const_iterator m_endPosition;
Modified: trunk/Source/WTF/wtf/WeakPtr.h (261817 => 261818)
--- trunk/Source/WTF/wtf/WeakPtr.h 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Source/WTF/wtf/WeakPtr.h 2020-05-18 17:16:16 UTC (rev 261818)
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2013 Google, Inc. All Rights Reserved.
- * Copyright (C) 2015, 2017 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2013 Google, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,27 +26,19 @@
#pragma once
-#include <wtf/MainThread.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/Ref.h>
-#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/Threading.h>
namespace WTF {
-// Testing interface for TestWebKitAPI
-#ifndef DID_CREATE_WEAK_PTR_IMPL
-#define DID_CREATE_WEAK_PTR_IMPL(p)
-#endif
-#ifndef WILL_DESTROY_WEAK_PTR_IMPL
-#define WILL_DESTROY_WEAK_PTR_IMPL(p)
-#endif
+template<typename, typename> class WeakHashSet;
+template<typename, typename> class WeakPtrFactory;
-template<typename> class WeakHashSet;
-template<typename> class WeakPtr;
-template<typename> class WeakPtrFactory;
+struct EmptyCounter {
+ static void increment() { }
+ static void decrement() { }
+};
-class WeakPtrImpl : public ThreadSafeRefCounted<WeakPtrImpl> {
+template<typename Counter = EmptyCounter> class WeakPtrImpl : public ThreadSafeRefCounted<WeakPtrImpl<Counter>> {
WTF_MAKE_NONCOPYABLE(WeakPtrImpl);
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -57,7 +49,7 @@
~WeakPtrImpl()
{
- WILL_DESTROY_WEAK_PTR_IMPL(m_ptr);
+ Counter::decrement();
}
template<typename T> typename T::WeakValueType* get()
@@ -79,7 +71,7 @@
, m_wasConstructedOnMainThread(isMainThread())
#endif
{
- DID_CREATE_WEAK_PTR_IMPL(ptr);
+ Counter::increment();
}
void* m_ptr;
@@ -88,20 +80,19 @@
#endif
};
-template<typename T>
-class WeakPtr {
+template<typename T, typename Counter> class WeakPtr {
WTF_MAKE_FAST_ALLOCATED;
public:
WeakPtr() { }
WeakPtr(std::nullptr_t) { }
- template<typename U> WeakPtr(const WeakPtr<U>&);
- template<typename U> WeakPtr(WeakPtr<U>&&);
+ template<typename U> WeakPtr(const WeakPtr<U, Counter>&);
+ template<typename U> WeakPtr(WeakPtr<U, Counter>&&);
T* get() const
{
// FIXME: Our GC threads currently need to get opaque pointers from WeakPtrs and have to be special-cased.
ASSERT(!m_impl || Thread::mayBeGCThread() || m_impl->wasConstructedOnMainThread() == isMainThread());
- return m_impl ? static_cast<T*>(m_impl->get<T>()) : nullptr;
+ return m_impl ? static_cast<T*>(m_impl->template get<T>()) : nullptr;
}
bool operator!() const { return !m_impl || !*m_impl; }
@@ -108,8 +99,8 @@
explicit operator bool() const { return m_impl && *m_impl; }
WeakPtr& operator=(std::nullptr_t) { m_impl = nullptr; return *this; }
- template<typename U> WeakPtr& operator=(const WeakPtr<U>&);
- template<typename U> WeakPtr& operator=(WeakPtr<U>&&);
+ template<typename U> WeakPtr& operator=(const WeakPtr<U, Counter>&);
+ template<typename U> WeakPtr& operator=(WeakPtr<U, Counter>&&);
T* operator->() const
{
@@ -126,21 +117,25 @@
void clear() { m_impl = nullptr; }
private:
- explicit WeakPtr(Ref<WeakPtrImpl>&& ref) : m_impl(WTFMove(ref)) { }
- template<typename> friend class WeakHashSet;
- template<typename> friend class WeakPtr;
- template<typename> friend class WeakPtrFactory;
- template<typename U> friend WeakPtr<U> makeWeakPtr(U&);
+ template<typename, typename> friend class WeakHashSet;
+ template<typename, typename> friend class WeakPtr;
+ template<typename, typename> friend class WeakPtrFactory;
- RefPtr<WeakPtrImpl> m_impl;
+ explicit WeakPtr(Ref<WeakPtrImpl<Counter>>&& ref)
+ : m_impl(WTFMove(ref))
+ {
+ }
+
+ RefPtr<WeakPtrImpl<Counter>> m_impl;
};
// Note: you probably want to inherit from CanMakeWeakPtr rather than use this directly.
-template<typename T>
-class WeakPtrFactory {
- WTF_MAKE_NONCOPYABLE(WeakPtrFactory<T>);
+template<typename T, typename Counter = EmptyCounter> class WeakPtrFactory {
+ WTF_MAKE_NONCOPYABLE(WeakPtrFactory);
WTF_MAKE_FAST_ALLOCATED;
public:
+ using CounterType = Counter;
+
WeakPtrFactory()
#if ASSERT_ENABLED
: m_wasConstructedOnMainThread(isMainThread())
@@ -161,25 +156,17 @@
return;
ASSERT(m_wasConstructedOnMainThread == isMainThread());
- m_impl = WeakPtrImpl::create(const_cast<T*>(&object));
+ m_impl = WeakPtrImpl<Counter>::create(const_cast<T*>(&object));
}
- WeakPtr<T> createWeakPtr(T& object) const
+ template<typename U> WeakPtr<U, Counter> createWeakPtr(U& object) const
{
initializeIfNeeded(object);
- ASSERT(&object == m_impl->get<T>());
- return WeakPtr<T>(makeRef(*m_impl));
+ ASSERT(&object == m_impl->template get<T>());
+ return WeakPtr<U, Counter>(makeRef(*m_impl));
}
- WeakPtr<const T> createWeakPtr(const T& object) const
- {
- initializeIfNeeded(object);
-
- ASSERT(&object == m_impl->get<T>());
- return WeakPtr<T>(makeRef(*m_impl));
- }
-
void revokeAll()
{
if (!m_impl)
@@ -190,9 +177,9 @@
}
private:
- template<typename> friend class WeakHashSet;
+ template<typename, typename> friend class WeakHashSet;
- mutable RefPtr<WeakPtrImpl> m_impl;
+ mutable RefPtr<WeakPtrImpl<Counter>> m_impl;
#if ASSERT_ENABLED
bool m_wasConstructedOnMainThread;
#endif
@@ -202,12 +189,12 @@
// initialization is however useful if you plan to call makeWeakPtr() from other threads.
enum class WeakPtrFactoryInitialization { Lazy, Eager };
-template<typename T, WeakPtrFactoryInitialization initializationMode = WeakPtrFactoryInitialization::Lazy> class CanMakeWeakPtr {
+template<typename T, WeakPtrFactoryInitialization initializationMode = WeakPtrFactoryInitialization::Lazy, typename Counter = EmptyCounter> class CanMakeWeakPtr {
public:
using WeakValueType = T;
- const WeakPtrFactory<T>& weakPtrFactory() const { return m_weakPtrFactory; }
- WeakPtrFactory<T>& weakPtrFactory() { return m_weakPtrFactory; }
+ const WeakPtrFactory<T, Counter>& weakPtrFactory() const { return m_weakPtrFactory; }
+ WeakPtrFactory<T, Counter>& weakPtrFactory() { return m_weakPtrFactory; }
protected:
CanMakeWeakPtr()
@@ -217,43 +204,43 @@
}
private:
- WeakPtrFactory<T> m_weakPtrFactory;
+ WeakPtrFactory<T, Counter> m_weakPtrFactory;
};
-template<typename T, typename U> inline WeakPtrImpl* weak_ptr_impl_cast(WeakPtrImpl* impl)
+template<typename T, typename U, typename Counter> inline WeakPtrImpl<Counter>* weak_ptr_impl_cast(WeakPtrImpl<Counter>* impl)
{
- static_assert(std::is_same<typename T::WeakValueType, typename U::WeakValueType>::value, "Invalid weak pointer cast");
+ static_assert(std::is_same_v<typename T::WeakValueType, typename U::WeakValueType>, "Invalid weak pointer cast");
return impl;
}
-template<typename T> template<typename U> inline WeakPtr<T>::WeakPtr(const WeakPtr<U>& o)
+template<typename T, typename Counter> template<typename U> inline WeakPtr<T, Counter>::WeakPtr(const WeakPtr<U, Counter>& o)
: m_impl(weak_ptr_impl_cast<T, U>(o.m_impl.get()))
{
}
-template<typename T> template<typename U> inline WeakPtr<T>::WeakPtr(WeakPtr<U>&& o)
+template<typename T, typename Counter> template<typename U> inline WeakPtr<T, Counter>::WeakPtr(WeakPtr<U, Counter>&& o)
: m_impl(adoptRef(weak_ptr_impl_cast<T, U>(o.m_impl.leakRef())))
{
}
-template<typename T> template<typename U> inline WeakPtr<T>& WeakPtr<T>::operator=(const WeakPtr<U>& o)
+template<typename T, typename Counter> template<typename U> inline WeakPtr<T, Counter>& WeakPtr<T, Counter>::operator=(const WeakPtr<U, Counter>& o)
{
m_impl = weak_ptr_impl_cast<T, U>(o.m_impl.get());
return *this;
}
-template<typename T> template<typename U> inline WeakPtr<T>& WeakPtr<T>::operator=(WeakPtr<U>&& o)
+template<typename T, typename Counter> template<typename U> inline WeakPtr<T, Counter>& WeakPtr<T, Counter>::operator=(WeakPtr<U, Counter>&& o)
{
m_impl = adoptRef(weak_ptr_impl_cast<T, U>(o.m_impl.leakRef()));
return *this;
}
-template<typename T> inline WeakPtr<T> makeWeakPtr(T& object)
+template<typename T> inline auto makeWeakPtr(T& object)
{
- return { object.weakPtrFactory().createWeakPtr(object) };
+ return object.weakPtrFactory().template createWeakPtr<T>(object);
}
-template<typename T> inline WeakPtr<T> makeWeakPtr(T* ptr)
+template<typename T> inline auto makeWeakPtr(T* ptr) -> decltype(makeWeakPtr(*ptr))
{
if (!ptr)
return { };
@@ -260,32 +247,32 @@
return makeWeakPtr(*ptr);
}
-template<typename T, typename U> inline bool operator==(const WeakPtr<T>& a, const WeakPtr<U>& b)
+template<typename T, typename U, typename Counter> inline bool operator==(const WeakPtr<T, Counter>& a, const WeakPtr<U, Counter>& b)
{
return a.get() == b.get();
}
-template<typename T, typename U> inline bool operator==(const WeakPtr<T>& a, U* b)
+template<typename T, typename U, typename Counter> inline bool operator==(const WeakPtr<T, Counter>& a, U* b)
{
return a.get() == b;
}
-template<typename T, typename U> inline bool operator==(T* a, const WeakPtr<U>& b)
+template<typename T, typename U, typename Counter> inline bool operator==(T* a, const WeakPtr<U, Counter>& b)
{
return a == b.get();
}
-template<typename T, typename U> inline bool operator!=(const WeakPtr<T>& a, const WeakPtr<U>& b)
+template<typename T, typename U, typename Counter> inline bool operator!=(const WeakPtr<T, Counter>& a, const WeakPtr<U, Counter>& b)
{
return a.get() != b.get();
}
-template<typename T, typename U> inline bool operator!=(const WeakPtr<T>& a, U* b)
+template<typename T, typename U, typename Counter> inline bool operator!=(const WeakPtr<T, Counter>& a, U* b)
{
return a.get() != b;
}
-template<typename T, typename U> inline bool operator!=(T* a, const WeakPtr<U>& b)
+template<typename T, typename U, typename Counter> inline bool operator!=(T* a, const WeakPtr<U, Counter>& b)
{
return a != b.get();
}
Modified: trunk/Source/WebCore/ChangeLog (261817 => 261818)
--- trunk/Source/WebCore/ChangeLog 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Source/WebCore/ChangeLog 2020-05-18 17:16:16 UTC (rev 261818)
@@ -1,3 +1,15 @@
+2020-05-18 Darin Adler <[email protected]>
+
+ Add iterator checking to ListHashSet
+ https://bugs.webkit.org/show_bug.cgi?id=211669
+
+ Reviewed by Anders Carlsson.
+
+ * page/ios/ContentChangeObserver.h: Added an include of Element.h, needed to call
+ makeWeakPtr in an inline function. This is due to a change in the way makeWeakPtr
+ now checks the type of the argument. It's possible we could refine it further to
+ relax this requirement, but it seems OK to include Element.h here.
+
2020-05-18 Zalan Bujtas <[email protected]>
[LFC][TFC] Add support for computing the collapsed table border
Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.h (261817 => 261818)
--- trunk/Source/WebCore/page/ios/ContentChangeObserver.h 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.h 2020-05-18 17:16:16 UTC (rev 261818)
@@ -29,6 +29,7 @@
#include "CSSPropertyNames.h"
#include "Document.h"
+#include "Element.h"
#include "PlatformEvent.h"
#include "RenderStyleConstants.h"
#include "Timer.h"
Modified: trunk/Tools/ChangeLog (261817 => 261818)
--- trunk/Tools/ChangeLog 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Tools/ChangeLog 2020-05-18 17:16:16 UTC (rev 261818)
@@ -1,3 +1,17 @@
+2020-05-18 Darin Adler <[email protected]>
+
+ Add iterator checking to ListHashSet
+ https://bugs.webkit.org/show_bug.cgi?id=211669
+
+ Reviewed by Anders Carlsson.
+
+ * TestWebKitAPI/Tests/WTF/WeakPtr.cpp: Removed use of the DID_CREATE_WEAK_PTR_IMPL
+ and WILL_DESTROY_WEAK_PTR_IMPL, which didn't work consistently because of the
+ one-definition rule. Instead, this file parameterizes the WeakPtr family of
+ class templates with a counter class. To avoid having to rewrite test code, used
+ alias templates to insert these class template into the TestWebKitAPI namespace,
+ hiding the class templates from the WTF namespace.
+
2020-05-18 Peng Liu <[email protected]>
[iPad Simulator] TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia is timing out
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp (261817 => 261818)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp 2020-05-18 17:08:19 UTC (rev 261817)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp 2020-05-18 17:16:16 UTC (rev 261818)
@@ -25,23 +25,23 @@
#include "config.h"
-static unsigned s_baseWeakReferences = 0;
-
-#define DID_CREATE_WEAK_PTR_IMPL(p) do { \
- ++s_baseWeakReferences; \
-} while (0);
-
-#define WILL_DESTROY_WEAK_PTR_IMPL(p) do { \
- --s_baseWeakReferences; \
-} while (0);
-
#include "Test.h"
-#include <wtf/HashSet.h>
#include <wtf/WeakHashSet.h>
-#include <wtf/WeakPtr.h>
namespace TestWebKitAPI {
+static unsigned s_baseWeakReferences = 0;
+
+struct WeakPtrCounter {
+ static void increment() { ++s_baseWeakReferences; }
+ static void decrement() { --s_baseWeakReferences; }
+};
+
+template<typename T> using CanMakeWeakPtr = WTF::CanMakeWeakPtr<T, WeakPtrFactoryInitialization::Lazy, WeakPtrCounter>;
+template<typename T> using WeakHashSet = WTF::WeakHashSet<T, WeakPtrCounter>;
+template<typename T> using WeakPtr = WTF::WeakPtr<T, WeakPtrCounter>;
+template<typename T> using WeakPtrFactory = WTF::WeakPtrFactory<T, WeakPtrCounter>;
+
struct Int : public CanMakeWeakPtr<Int> {
Int(int i) : m_i(i) { }
operator int() const { return m_i; }
@@ -74,10 +74,6 @@
}
};
-}
-
-namespace TestWebKitAPI {
-
TEST(WTF_WeakPtr, Basic)
{
Int dummy(5);