Modified: trunk/Source/WTF/ChangeLog (241781 => 241782)
--- trunk/Source/WTF/ChangeLog 2019-02-19 23:17:17 UTC (rev 241781)
+++ trunk/Source/WTF/ChangeLog 2019-02-19 23:18:27 UTC (rev 241782)
@@ -1,3 +1,16 @@
+2019-02-19 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r241770.
+ https://bugs.webkit.org/show_bug.cgi?id=194833
+
+ Caused crashes (Requested by smfr on #webkit).
+
+ Reverted changeset:
+
+ "Code quality cleanup in NeverDestroyed"
+ https://bugs.webkit.org/show_bug.cgi?id=194824
+ https://trac.webkit.org/changeset/241770
+
2019-02-19 Keith Miller <[email protected]>
Code quality cleanup in NeverDestroyed
Modified: trunk/Source/WTF/wtf/NeverDestroyed.h (241781 => 241782)
--- trunk/Source/WTF/wtf/NeverDestroyed.h 2019-02-19 23:17:17 UTC (rev 241781)
+++ trunk/Source/WTF/wtf/NeverDestroyed.h 2019-02-19 23:18:27 UTC (rev 241782)
@@ -27,7 +27,6 @@
#include <type_traits>
#include <utility>
-#include <wtf/ForbidHeapAllocation.h>
#include <wtf/RefCounted.h>
// NeverDestroyed is a smart-pointer-like class that ensures that the destructor
@@ -44,9 +43,8 @@
template<typename T> class NeverDestroyed {
WTF_MAKE_NONCOPYABLE(NeverDestroyed);
- WTF_FORBID_HEAP_ALLOCATION;
+
public:
-
template<typename... Args> NeverDestroyed(Args&&... args)
{
MaybeRelax<T>(new (storagePointer()) T(std::forward<Args>(args)...));
@@ -68,6 +66,10 @@
PointerType storagePointer() const { return const_cast<PointerType>(reinterpret_cast<const T*>(&m_storage)); }
+ // FIXME: Investigate whether we should allocate a hunk of virtual memory
+ // and hand out chunks of it to NeverDestroyed instead, to reduce fragmentation.
+ typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_storage;
+
template<typename PtrType, bool ShouldRelax = std::is_base_of<RefCountedBase, PtrType>::value> struct MaybeRelax {
explicit MaybeRelax(PtrType*) { }
};
@@ -74,10 +76,6 @@
template<typename PtrType> struct MaybeRelax<PtrType, true> {
explicit MaybeRelax(PtrType* ptr) { ptr->relaxAdoptionRequirement(); }
};
-
- // FIXME: Investigate whether we should allocate a hunk of virtual memory
- // and hand out chunks of it to NeverDestroyed instead, to reduce fragmentation.
- typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_storage;
};
template<typename T> NeverDestroyed<T> makeNeverDestroyed(T&&);
@@ -87,7 +85,7 @@
// share more of the code with the main NeverDestroyed above.
template<typename T> class LazyNeverDestroyed {
WTF_MAKE_NONCOPYABLE(LazyNeverDestroyed);
- WTF_FORBID_HEAP_ALLOCATION;
+
public:
LazyNeverDestroyed() = default;
@@ -126,6 +124,10 @@
return const_cast<PointerType>(reinterpret_cast<const T*>(&m_storage));
}
+ // FIXME: Investigate whether we should allocate a hunk of virtual memory
+ // and hand out chunks of it to NeverDestroyed instead, to reduce fragmentation.
+ typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_storage;
+
template<typename PtrType, bool ShouldRelax = std::is_base_of<RefCountedBase, PtrType>::value> struct MaybeRelax {
explicit MaybeRelax(PtrType*) { }
};
@@ -138,10 +140,6 @@
// It must not be initialized dynamically; that would not be thread safe.
bool m_isConstructed;
#endif
-
- // FIXME: Investigate whether we should allocate a hunk of virtual memory
- // and hand out chunks of it to NeverDestroyed instead, to reduce fragmentation.
- typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_storage;
};
template<typename T> inline NeverDestroyed<T> makeNeverDestroyed(T&& argument)