Diff
Modified: trunk/Source/WTF/ChangeLog (245862 => 245863)
--- trunk/Source/WTF/ChangeLog 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WTF/ChangeLog 2019-05-29 20:07:56 UTC (rev 245863)
@@ -1,3 +1,15 @@
+2019-05-29 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r245857.
+
+ Breaks internal builds.
+
+ Reverted changeset:
+
+ "WeakPtr breaks vtables when upcasting to base classes"
+ https://bugs.webkit.org/show_bug.cgi?id=188799
+ https://trac.webkit.org/changeset/245857
+
2019-05-28 Geoffrey Garen <gga...@apple.com>
WeakPtr breaks vtables when upcasting to base classes
Modified: trunk/Source/WTF/wtf/WeakHashSet.h (245862 => 245863)
--- trunk/Source/WTF/wtf/WeakHashSet.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WTF/wtf/WeakHashSet.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -32,18 +32,10 @@
namespace WTF {
-template<> struct HashTraits<Ref<WeakReference>> : RefHashTraits<WeakReference> {
- static const bool hasIsReleasedWeakValueFunction = true;
- static bool isReleasedWeakValue(const Ref<WeakReference>& value)
- {
- return !value.isHashTableDeletedValue() && !value.isHashTableEmptyValue() && !value.get();
- }
-};
-
template <typename T>
class WeakHashSet {
public:
- typedef HashSet<Ref<WeakReference>> WeakReferenceSet;
+ typedef HashSet<Ref<WeakReference<T>>> WeakReferenceSet;
class WeakHashSetConstIterator : public std::iterator<std::forward_iterator_tag, T, std::ptrdiff_t, const T*, const T&> {
private:
@@ -54,7 +46,7 @@
}
public:
- T* get() const { return m_position->get().template get<T, typename T::WeakValueType>(); }
+ T* get() const { return m_position->get().get(); }
T& operator*() const { return *get(); }
T* operator->() const { return get(); }
@@ -68,7 +60,7 @@
void skipEmptyBuckets()
{
- while (m_position != m_endPosition && !get())
+ while (m_position != m_endPosition && !m_position->get().get())
++m_position;
}
@@ -104,33 +96,42 @@
template <typename U>
bool remove(const U& value)
{
- auto& weakReference = value.weakPtrFactory().m_ref;
- if (!weakReference || !*weakReference)
+ auto* weakReference = weak_reference_downcast<T>(value.weakPtrFactory().m_ref.get());
+ if (!weakReference)
return false;
- return m_set.remove(*weakReference);
+ return m_set.remove(weakReference);
}
template <typename U>
bool contains(const U& value) const
{
- auto& weakReference = value.weakPtrFactory().m_ref;
- if (!weakReference || !*weakReference)
+ auto* weakReference = weak_reference_downcast<T>(value.weakPtrFactory().m_ref.get());
+ if (!weakReference)
return false;
- return m_set.contains(*weakReference);
+ return m_set.contains(weakReference);
}
unsigned capacity() const { return m_set.capacity(); }
- bool computesEmpty() const { return begin() == end(); }
+ bool computesEmpty() const
+ {
+ if (m_set.isEmpty())
+ return true;
+ for (auto& value : m_set) {
+ if (value->get())
+ return false;
+ }
+ return true;
+ }
bool hasNullReferences() const
{
- return WTF::anyOf(m_set, [] (auto& value) { return !value.get(); });
+ return WTF::anyOf(m_set, [] (auto& value) { return !value->get(); });
}
unsigned computeSize() const
{
- const_cast<WeakReferenceSet&>(m_set).removeIf([] (auto& value) { return !value.get(); });
+ const_cast<WeakReferenceSet&>(m_set).removeIf([] (auto& value) { return !value->get(); });
return m_set.size();
}
@@ -144,6 +145,14 @@
WeakReferenceSet m_set;
};
+template<typename T> struct HashTraits<Ref<WeakReference<T>>> : RefHashTraits<WeakReference<T>> {
+ static const bool hasIsReleasedWeakValueFunction = true;
+ static bool isReleasedWeakValue(const Ref<WeakReference<T>>& value)
+ {
+ return !value.isHashTableDeletedValue() && !value.isHashTableEmptyValue() && !value.get().get();
+ }
+};
+
} // namespace WTF
using WTF::WeakHashSet;
Modified: trunk/Source/WTF/wtf/WeakPtr.h (245862 => 245863)
--- trunk/Source/WTF/wtf/WeakPtr.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WTF/wtf/WeakPtr.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -33,43 +33,34 @@
namespace WTF {
-// Testing interface for TestWebKitAPI
-#ifndef DID_CREATE_WEAK_REFERENCE
-#define DID_CREATE_WEAK_REFERENCE(p)
-#endif
-#ifndef WILL_DESTROY_WEAK_REFERENCE
-#define WILL_DESTROY_WEAK_REFERENCE(p)
-#endif
-
template<typename> class WeakHashSet;
template<typename> class WeakPtr;
template<typename> class WeakPtrFactory;
// Note: WeakReference is an implementation detail, and should not be used directly.
-class WeakReference : public ThreadSafeRefCounted<WeakReference> {
- WTF_MAKE_NONCOPYABLE(WeakReference);
+template<typename T>
+class WeakReference : public ThreadSafeRefCounted<WeakReference<T>> {
+ WTF_MAKE_NONCOPYABLE(WeakReference<T>);
WTF_MAKE_FAST_ALLOCATED;
public:
- template<typename T> static Ref<WeakReference> create(T* ptr) { return adoptRef(*new WeakReference(ptr)); }
+ ~WeakReference() { } // So that we can use a template specialization for testing purposes to detect leaks.
- ~WeakReference()
- {
- WILL_DESTROY_WEAK_REFERENCE(m_ptr);
- }
+ T* get() const { return m_ptr; }
- template<typename T, typename WeakValueType> T* get() const { return static_cast<T*>(static_cast<WeakValueType*>(m_ptr)); }
- explicit operator bool() const { return m_ptr; }
-
void clear() { m_ptr = nullptr; }
private:
- template<typename T> explicit WeakReference(T* ptr)
+ friend class WeakPtr<T>;
+ friend class WeakPtrFactory<T>;
+
+ static Ref<WeakReference<T>> create(T* ptr) { return adoptRef(*new WeakReference(ptr)); }
+
+ explicit WeakReference(T* ptr)
: m_ptr(ptr)
{
- DID_CREATE_WEAK_REFERENCE(ptr);
}
- void* m_ptr;
+ T* m_ptr;
};
template<typename T>
@@ -78,29 +69,28 @@
public:
WeakPtr() { }
WeakPtr(std::nullptr_t) { }
+ WeakPtr(Ref<WeakReference<T>>&& ref) : m_ref(std::forward<Ref<WeakReference<T>>>(ref)) { }
template<typename U> WeakPtr(const WeakPtr<U>&);
template<typename U> WeakPtr(WeakPtr<U>&&);
- T* get() const { return m_ref ? m_ref->template get<T, typename T::WeakValueType>() : nullptr; }
- explicit operator bool() const { return m_ref && *m_ref; }
+ T* get() const { return m_ref ? m_ref->get() : nullptr; }
+ explicit operator bool() const { return m_ref && m_ref->get(); }
WeakPtr& operator=(std::nullptr_t) { m_ref = nullptr; return *this; }
template<typename U> WeakPtr& operator=(const WeakPtr<U>&);
template<typename U> WeakPtr& operator=(WeakPtr<U>&&);
- T* operator->() const { return get(); }
- T& operator*() const { return *get(); }
+ T* operator->() const { return m_ref->get(); }
+ T& operator*() const { return *m_ref->get(); }
void clear() { m_ref = nullptr; }
private:
- explicit WeakPtr(Ref<WeakReference>&& ref) : m_ref(std::move(ref)) { }
template<typename> friend class WeakHashSet;
template<typename> friend class WeakPtr;
- template<typename> friend class WeakPtrFactory;
template<typename U> friend WeakPtr<U> makeWeakPtr(U&);
- RefPtr<WeakReference> m_ref;
+ RefPtr<WeakReference<T>> m_ref;
};
// Note: you probably want to inherit from CanMakeWeakPtr rather than use this directly.
@@ -120,15 +110,15 @@
WeakPtr<T> createWeakPtr(T& ptr) const
{
if (!m_ref)
- m_ref = WeakReference::create(&ptr);
- return WeakPtr<T>(makeRef(*m_ref));
+ m_ref = WeakReference<T>::create(&ptr);
+ return { makeRef(*m_ref) };
}
WeakPtr<const T> createWeakPtr(const T& ptr) const
{
if (!m_ref)
- m_ref = WeakReference::create(const_cast<T*>(&ptr));
- return WeakPtr<T>(makeRef(*m_ref));
+ m_ref = WeakReference<T>::create(const_cast<T*>(&ptr));
+ return { makeRef(reinterpret_cast<WeakReference<const T>&>(*m_ref)) };
}
void revokeAll()
@@ -143,13 +133,11 @@
private:
template<typename> friend class WeakHashSet;
- mutable RefPtr<WeakReference> m_ref;
+ mutable RefPtr<WeakReference<T>> m_ref;
};
template<typename T> class CanMakeWeakPtr {
public:
- typedef T WeakValueType;
-
const WeakPtrFactory<T>& weakPtrFactory() const { return m_weakFactory; }
WeakPtrFactory<T>& weakPtrFactory() { return m_weakFactory; }
@@ -157,37 +145,43 @@
WeakPtrFactory<T> m_weakFactory;
};
-template<typename T, typename U> inline WeakReference* weak_reference_cast(WeakReference* weakReference)
+template<typename T, typename U> inline WeakReference<T>* weak_reference_upcast(WeakReference<U>* weakReference)
{
- UNUSED_VARIABLE(static_cast<T*>(static_cast<typename U::WeakValueType*>(nullptr))); // Verify that casting is valid.
- return weakReference;
+ static_assert(std::is_convertible<U*, T*>::value, "U* must be convertible to T*");
+ return reinterpret_cast<WeakReference<T>*>(weakReference);
}
+template<typename T, typename U> inline WeakReference<T>* weak_reference_downcast(WeakReference<U>* weakReference)
+{
+ static_assert(std::is_convertible<T*, U*>::value, "T* must be convertible to U*");
+ return reinterpret_cast<WeakReference<T>*>(weakReference);
+}
+
template<typename T> template<typename U> inline WeakPtr<T>::WeakPtr(const WeakPtr<U>& o)
- : m_ref(weak_reference_cast<T, U>(o.m_ref.get()))
+ : m_ref(weak_reference_upcast<T>(o.m_ref.get()))
{
}
template<typename T> template<typename U> inline WeakPtr<T>::WeakPtr(WeakPtr<U>&& o)
- : m_ref(adoptRef(weak_reference_cast<T, U>(o.m_ref.leakRef())))
+ : m_ref(adoptRef(weak_reference_upcast<T>(o.m_ref.leakRef())))
{
}
template<typename T> template<typename U> inline WeakPtr<T>& WeakPtr<T>::operator=(const WeakPtr<U>& o)
{
- m_ref = weak_reference_cast<T, U>(o.m_ref.get());
+ m_ref = weak_reference_upcast<T>(o.m_ref.get());
return *this;
}
template<typename T> template<typename U> inline WeakPtr<T>& WeakPtr<T>::operator=(WeakPtr<U>&& o)
{
- m_ref = adoptRef(weak_reference_cast<T, U>(o.m_ref.leakRef()));
+ m_ref = adoptRef(weak_reference_upcast<T>(o.m_ref.leakRef()));
return *this;
}
template<typename T> inline WeakPtr<T> makeWeakPtr(T& ref)
{
- return { ref.weakPtrFactory().createWeakPtr(ref) };
+ return { adoptRef(*weak_reference_downcast<T>(ref.weakPtrFactory().createWeakPtr(ref).m_ref.leakRef())) };
}
template<typename T> inline WeakPtr<T> makeWeakPtr(T* ptr)
Modified: trunk/Source/WebCore/ChangeLog (245862 => 245863)
--- trunk/Source/WebCore/ChangeLog 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/ChangeLog 2019-05-29 20:07:56 UTC (rev 245863)
@@ -1,3 +1,15 @@
+2019-05-29 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r245857.
+
+ Breaks internal builds.
+
+ Reverted changeset:
+
+ "WeakPtr breaks vtables when upcasting to base classes"
+ https://bugs.webkit.org/show_bug.cgi?id=188799
+ https://trac.webkit.org/changeset/245857
+
2019-05-29 Keith Rollin <krol...@apple.com>
Fix builds that don't use makeWindowFromView
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (245862 => 245863)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -94,7 +94,7 @@
UNUSED_PARAM(m_closed);
UNUSED_PARAM(m_uninitialized);
- m_instanceSession->setClient(makeWeakPtr(*this));
+ m_instanceSession->setClient(m_cdmInstanceSessionClientWeakPtrFactory.createWeakPtr(*this));
}
MediaKeySession::~MediaKeySession()
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (245862 => 245863)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -52,7 +52,7 @@
class MediaKeys;
class SharedBuffer;
-class MediaKeySession final : public RefCounted<MediaKeySession>, public EventTargetWithInlineData, public ActiveDOMObject, public CDMInstanceSessionClient {
+class MediaKeySession final : public RefCounted<MediaKeySession>, public EventTargetWithInlineData, public ActiveDOMObject, public CanMakeWeakPtr<MediaKeySession>, public CDMInstanceSessionClient {
WTF_MAKE_ISO_ALLOCATED(MediaKeySession);
public:
static Ref<MediaKeySession> create(ScriptExecutionContext&, WeakPtr<MediaKeys>&&, MediaKeySessionType, bool useDistinctiveIdentifier, Ref<CDM>&&, Ref<CDMInstanceSession>&&);
@@ -120,6 +120,7 @@
double m_firstDecryptTime { 0 };
double m_latestDecryptTime { 0 };
Vector<std::pair<Ref<SharedBuffer>, MediaKeyStatus>> m_statuses;
+ WeakPtrFactory<CDMInstanceSessionClient> m_cdmInstanceSessionClientWeakPtrFactory;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSFontFace.cpp (245862 => 245863)
--- trunk/Source/WebCore/css/CSSFontFace.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/css/CSSFontFace.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -122,11 +122,6 @@
return true;
}
-FontFace* CSSFontFace::existingWrapper()
-{
- return m_wrapper.get();
-}
-
static FontSelectionRange calculateWeightRange(CSSValue& value)
{
if (value.isValueList()) {
Modified: trunk/Source/WebCore/css/CSSFontFace.h (245862 => 245863)
--- trunk/Source/WebCore/css/CSSFontFace.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/css/CSSFontFace.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -150,7 +150,7 @@
// We don't guarantee that the FontFace wrapper will be the same every time you ask for it.
Ref<FontFace> wrapper();
void setWrapper(FontFace&);
- FontFace* existingWrapper();
+ FontFace* existingWrapper() { return m_wrapper.get(); }
struct FontLoadTiming {
Seconds blockPeriod;
Modified: trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp (245862 => 245863)
--- trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -39,11 +39,6 @@
{
}
-StyleSheetContents* CSSDeferredParser::styleSheet() const
-{
- return m_styleSheet.get();
-}
-
Ref<ImmutableStyleProperties> CSSDeferredParser::parseDeclaration(const CSSParserTokenRange& range)
{
return CSSParserImpl::parseDeferredDeclaration(range, m_context, m_styleSheet.get());
Modified: trunk/Source/WebCore/css/parser/CSSDeferredParser.h (245862 => 245863)
--- trunk/Source/WebCore/css/parser/CSSDeferredParser.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/css/parser/CSSDeferredParser.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -47,7 +47,7 @@
CSSParserMode mode() const { return m_context.mode; }
const CSSParserContext& context() const { return m_context; }
- StyleSheetContents* styleSheet() const;
+ StyleSheetContents* styleSheet() const { return m_styleSheet.get(); }
Ref<ImmutableStyleProperties> parseDeclaration(const CSSParserTokenRange&);
void parseRuleList(const CSSParserTokenRange&, Vector<RefPtr<StyleRuleBase>>&);
Modified: trunk/Source/WebCore/dom/ContainerNode.h (245862 => 245863)
--- trunk/Source/WebCore/dom/ContainerNode.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/dom/ContainerNode.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -25,7 +25,6 @@
#include "CollectionType.h"
#include "Node.h"
-#include <wtf/WeakPtr.h>
namespace WebCore {
@@ -36,7 +35,7 @@
const int initialNodeVectorSize = 11; // Covers 99.5%. See webkit.org/b/80706
typedef Vector<Ref<Node>, initialNodeVectorSize> NodeVector;
-class ContainerNode : public CanMakeWeakPtr<ContainerNode>, public Node {
+class ContainerNode : public Node {
WTF_MAKE_ISO_ALLOCATED(ContainerNode);
public:
virtual ~ContainerNode();
Modified: trunk/Source/WebCore/dom/Document.h (245862 => 245863)
--- trunk/Source/WebCore/dom/Document.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/dom/Document.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -347,6 +347,7 @@
, public TreeScope
, public ScriptExecutionContext
, public FontSelectorClient
+ , public CanMakeWeakPtr<Document>
, public FrameDestructionObserver
, public Supplementable<Document>
, public Logger::Observer {
Modified: trunk/Source/WebCore/dom/Element.h (245862 => 245863)
--- trunk/Source/WebCore/dom/Element.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/dom/Element.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -77,7 +77,7 @@
enum class TouchAction : uint8_t;
#endif
-class Element : public ContainerNode {
+class Element : public ContainerNode , public CanMakeWeakPtr<Element> {
WTF_MAKE_ISO_ALLOCATED(Element);
public:
static Ref<Element> create(const QualifiedName&, Document&);
Modified: trunk/Source/WebCore/dom/FullscreenManager.cpp (245862 => 245863)
--- trunk/Source/WebCore/dom/FullscreenManager.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/dom/FullscreenManager.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -439,11 +439,6 @@
m_fullscreenRenderer = makeWeakPtr(renderer);
}
-RenderFullScreen* FullscreenManager::fullscreenRenderer() const
-{
- return m_fullscreenRenderer.get();
-}
-
void FullscreenManager::dispatchFullscreenChangeEvents()
{
// Since we dispatch events in this function, it's possible that the
Modified: trunk/Source/WebCore/dom/FullscreenManager.h (245862 => 245863)
--- trunk/Source/WebCore/dom/FullscreenManager.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/dom/FullscreenManager.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -79,7 +79,7 @@
WEBCORE_EXPORT void didExitFullscreen();
void setFullscreenRenderer(RenderTreeBuilder&, RenderFullScreen&);
- RenderFullScreen* fullscreenRenderer() const;
+ RenderFullScreen* fullscreenRenderer() const { return m_fullscreenRenderer.get(); }
void dispatchFullscreenChangeEvents();
bool fullscreenIsAllowedForElement(Element&) const;
Modified: trunk/Source/WebCore/html/FormAssociatedElement.cpp (245862 => 245863)
--- trunk/Source/WebCore/html/FormAssociatedElement.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/html/FormAssociatedElement.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -119,11 +119,6 @@
return currentAssociatedForm;
}
-HTMLFormElement* FormAssociatedElement::form() const
-{
- return m_form.get();
-}
-
void FormAssociatedElement::formOwnerRemovedFromTree(const Node& formRoot)
{
ASSERT(m_form);
Modified: trunk/Source/WebCore/html/FormAssociatedElement.h (245862 => 245863)
--- trunk/Source/WebCore/html/FormAssociatedElement.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/html/FormAssociatedElement.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -48,7 +48,7 @@
void deref() { derefFormAssociatedElement(); }
static HTMLFormElement* findAssociatedForm(const HTMLElement*, HTMLFormElement*);
- WEBCORE_EXPORT HTMLFormElement* form() const;
+ HTMLFormElement* form() const { return m_form.get(); }
ValidityState* validity();
virtual bool isFormControlElement() const = 0;
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (245862 => 245863)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -149,9 +149,6 @@
{
WTF_MAKE_ISO_ALLOCATED(HTMLMediaElement);
public:
- typedef HTMLElement::WeakValueType WeakValueType;
- using HTMLElement::weakPtrFactory;
-
RefPtr<MediaPlayer> player() const { return m_player; }
virtual bool isVideo() const { return false; }
@@ -578,6 +575,8 @@
enum class AutoplayEventPlaybackState { None, PreventedAutoplay, StartedWithUserGesture, StartedWithoutUserGesture };
+ using HTMLElement::weakPtrFactory;
+
protected:
HTMLMediaElement(const QualifiedName&, Document&, bool createdByParser);
virtual void finishInitialization();
Modified: trunk/Source/WebCore/loader/MediaResourceLoader.cpp (245862 => 245863)
--- trunk/Source/WebCore/loader/MediaResourceLoader.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/loader/MediaResourceLoader.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -97,7 +97,7 @@
loaderOptions.destination = m_mediaElement && !m_mediaElement->isVideo() ? FetchOptions::Destination::Audio : FetchOptions::Destination::Video;
auto cachedRequest = createPotentialAccessControlRequest(WTFMove(request), *m_document, m_crossOriginMode, WTFMove(loaderOptions));
if (m_mediaElement)
- cachedRequest.setInitiator(*m_mediaElement);
+ cachedRequest.setInitiator(*m_mediaElement.get());
auto resource = m_document->cachedResourceLoader().requestMedia(WTFMove(cachedRequest)).value_or(nullptr);
if (!resource)
Modified: trunk/Source/WebCore/page/DOMWindowProperty.cpp (245862 => 245863)
--- trunk/Source/WebCore/page/DOMWindowProperty.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/page/DOMWindowProperty.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -42,9 +42,4 @@
return m_window ? m_window->frame() : nullptr;
}
-DOMWindow* DOMWindowProperty::window() const
-{
- return m_window.get();
}
-
-}
Modified: trunk/Source/WebCore/page/DOMWindowProperty.h (245862 => 245863)
--- trunk/Source/WebCore/page/DOMWindowProperty.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/page/DOMWindowProperty.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -35,7 +35,7 @@
class DOMWindowProperty {
public:
Frame* frame() const;
- DOMWindow* window() const;
+ DOMWindow* window() const { return m_window.get(); }
protected:
explicit DOMWindowProperty(DOMWindow*);
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (245862 => 245863)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -458,11 +458,6 @@
layout();
}
-RenderElement* FrameViewLayoutContext::subtreeLayoutRoot() const
-{
- return m_subtreeLayoutRoot.get();
-}
-
void FrameViewLayoutContext::convertSubtreeLayoutToFullLayout()
{
ASSERT(subtreeLayoutRoot());
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.h (245862 => 245863)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -27,6 +27,7 @@
#include "LayoutUnit.h"
#include "Timer.h"
+
#include <wtf/WeakPtr.h>
namespace WebCore {
@@ -81,7 +82,7 @@
unsigned layoutCount() const { return m_layoutCount; }
- RenderElement* subtreeLayoutRoot() const;
+ RenderElement* subtreeLayoutRoot() const { return m_subtreeLayoutRoot.get(); }
void clearSubtreeLayoutRoot() { m_subtreeLayoutRoot.clear(); }
void convertSubtreeLayoutToFullLayout();
Modified: trunk/Source/WebCore/page/UndoItem.cpp (245862 => 245863)
--- trunk/Source/WebCore/page/UndoItem.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/page/UndoItem.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -33,11 +33,6 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(UndoItem);
-UndoManager* UndoItem::undoManager() const
-{
- return m_undoManager.get();
-}
-
void UndoItem::setUndoManager(UndoManager* undoManager)
{
m_undoManager = makeWeakPtr(undoManager);
Modified: trunk/Source/WebCore/page/UndoItem.h (245862 => 245863)
--- trunk/Source/WebCore/page/UndoItem.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/page/UndoItem.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -55,7 +55,7 @@
Document* document() const;
- UndoManager* undoManager() const;
+ UndoManager* undoManager() const { return m_undoManager.get(); }
void setUndoManager(UndoManager*);
const String& label() const { return m_label; }
Modified: trunk/Source/WebCore/platform/ScrollView.h (245862 => 245863)
--- trunk/Source/WebCore/platform/ScrollView.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/ScrollView.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -65,9 +65,6 @@
public:
virtual ~ScrollView();
- typedef Widget::WeakValueType WeakValueType;
- using Widget::weakPtrFactory;
-
// ScrollableArea functions.
int scrollSize(ScrollbarOrientation) const final;
int scrollOffset(ScrollbarOrientation) const final;
@@ -77,6 +74,8 @@
virtual void notifyPageThatContentAreaWillPaint() const;
+ using Widget::weakPtrFactory;
+
IntPoint locationOfContents() const;
// NOTE: This should only be called by the overridden setScrollOffset from ScrollableArea.
Modified: trunk/Source/WebCore/platform/Widget.cpp (245862 => 245863)
--- trunk/Source/WebCore/platform/Widget.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/Widget.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -42,11 +42,6 @@
retainPlatformWidget();
}
-ScrollView* Widget::parent() const
-{
- return m_parent.get();
-}
-
void Widget::setParent(ScrollView* view)
{
ASSERT(!view || !m_parent);
Modified: trunk/Source/WebCore/platform/Widget.h (245862 => 245863)
--- trunk/Source/WebCore/platform/Widget.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/Widget.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -140,7 +140,7 @@
WEBCORE_EXPORT void removeFromParent();
WEBCORE_EXPORT virtual void setParent(ScrollView* view);
- WEBCORE_EXPORT ScrollView* parent() const;
+ ScrollView* parent() const { return m_parent.get(); }
FrameView* root() const;
virtual void handleEvent(Event&) { }
Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h (245862 => 245863)
--- trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -39,7 +39,7 @@
class SharedBuffer;
-class CDMInstanceSessionClient : public CanMakeWeakPtr<CDMInstanceSessionClient> {
+class CDMInstanceSessionClient {
public:
virtual ~CDMInstanceSessionClient() = default;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (245862 => 245863)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -337,6 +337,7 @@
bool performTaskAtMediaTime(WTF::Function<void()>&&, MediaTime) final;
void setShouldObserveTimeControlStatus(bool);
+ WeakPtrFactory<MediaPlayerPrivateAVFoundationObjC> m_weakPtrFactory;
RetainPtr<AVURLAsset> m_avAsset;
RetainPtr<AVPlayer> m_avPlayer;
RetainPtr<AVPlayerItem> m_avPlayerItem;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (245862 => 245863)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2019-05-29 20:07:56 UTC (rev 245863)
@@ -359,14 +359,14 @@
: MediaPlayerPrivateAVFoundation(player)
, m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>())
, m_videoFullscreenGravity(MediaPlayer::VideoGravityResizeAspect)
- , m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithPlayer:makeWeakPtr(*this)]))
+ , m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithPlayer:m_weakPtrFactory.createWeakPtr(*this)]))
, m_videoFrameHasDrawn(false)
, m_haveCheckedPlayability(false)
#if HAVE(AVFOUNDATION_VIDEO_OUTPUT)
- , m_videoOutputDelegate(adoptNS([[WebCoreAVFPullDelegate alloc] initWithPlayer:makeWeakPtr(*this)]))
+ , m_videoOutputDelegate(adoptNS([[WebCoreAVFPullDelegate alloc] initWithPlayer:m_weakPtrFactory.createWeakPtr(*this)]))
#endif
#if HAVE(AVFOUNDATION_LOADER_DELEGATE)
- , m_loaderDelegate(adoptNS([[WebCoreAVFLoaderDelegate alloc] initWithPlayer:makeWeakPtr(*this)]))
+ , m_loaderDelegate(adoptNS([[WebCoreAVFLoaderDelegate alloc] initWithPlayer:m_weakPtrFactory.createWeakPtr(*this)]))
#endif
, m_currentTextTrack(0)
, m_cachedRate(0)
@@ -387,7 +387,7 @@
MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC()
{
- weakPtrFactory().revokeAll();
+ m_weakPtrFactory.revokeAll();
#if HAVE(AVFOUNDATION_LOADER_DELEGATE)
[[m_avAsset.get() resourceLoader] setDelegate:nil queue:0];
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (245862 => 245863)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -59,8 +59,7 @@
class MediaPlayerPrivateMediaSourceAVFObjC
- : public CanMakeWeakPtr<MediaPlayerPrivateMediaSourceAVFObjC>
- , public MediaPlayerPrivateInterface
+ : public MediaPlayerPrivateInterface
#if !RELEASE_LOG_DISABLED
, private LoggerHelper
#endif
@@ -122,7 +121,7 @@
AVStreamSession *streamSession();
#endif
void setCDMSession(LegacyCDMSession*) override;
- CDMSessionMediaSourceAVFObjC* cdmSession() const;
+ CDMSessionMediaSourceAVFObjC* cdmSession() const { return m_session.get(); }
#endif
#if ENABLE(ENCRYPTED_MEDIA)
@@ -148,6 +147,8 @@
const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const;
bool shouldCheckHardwareSupport() const;
+ WeakPtr<MediaPlayerPrivateMediaSourceAVFObjC> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(*this); }
+
#if !RELEASE_LOG_DISABLED
const Logger& logger() const final { return m_logger.get(); }
const char* logClassName() const override { return "MediaPlayerPrivateMediaSourceAVFObjC"; }
@@ -281,6 +282,7 @@
std::unique_ptr<PendingSeek> m_pendingSeek;
MediaPlayer* m_player;
+ WeakPtrFactory<MediaPlayerPrivateMediaSourceAVFObjC> m_weakPtrFactory;
WeakPtrFactory<MediaPlayerPrivateMediaSourceAVFObjC> m_sizeChangeObserverWeakPtrFactory;
RefPtr<MediaSourcePrivateAVFObjC> m_mediaSourcePrivate;
RetainPtr<AVAsset> m_asset;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (245862 => 245863)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2019-05-29 20:07:56 UTC (rev 245863)
@@ -52,7 +52,6 @@
#import <wtf/FileSystem.h>
#import <wtf/MainThread.h>
#import <wtf/NeverDestroyed.h>
-#import <wtf/WeakPtr.h>
#import "CoreVideoSoftLink.h"
#import <pal/cf/CoreMediaSoftLink.h>
@@ -88,10 +87,10 @@
static void CMTimebaseEffectiveRateChangedCallback(CMNotificationCenterRef, const void *listener, CFStringRef, const void *, CFTypeRef)
{
MediaPlayerPrivateMediaSourceAVFObjC* player = (MediaPlayerPrivateMediaSourceAVFObjC*)const_cast<void*>(listener);
- callOnMainThread([weakThis = makeWeakPtr(player)] {
+ callOnMainThread([weakThis = player->createWeakPtr()] {
if (!weakThis)
return;
- weakThis->effectiveRateChanged();
+ weakThis.get()->effectiveRateChanged();
});
}
@@ -121,7 +120,7 @@
// addPeriodicTimeObserverForInterval: throws an exception if you pass a non-numeric CMTime, so just use
// an arbitrarily large time value of once an hour:
- __block auto weakThis = makeWeakPtr(*this);
+ __block auto weakThis = createWeakPtr();
m_timeJumpedObserver = [m_synchronizer addPeriodicTimeObserverForInterval:PAL::toCMTime(MediaTime::createWithDouble(3600)) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {
#if LOG_DISABLED
UNUSED_PARAM(time);
@@ -287,7 +286,7 @@
void MediaPlayerPrivateMediaSourceAVFObjC::play()
{
ALWAYS_LOG(LOGIDENTIFIER);
- callOnMainThread([weakThis = makeWeakPtr(*this)] {
+ callOnMainThread([weakThis = createWeakPtr()] {
if (!weakThis)
return;
weakThis.get()->playInternal();
@@ -308,7 +307,7 @@
void MediaPlayerPrivateMediaSourceAVFObjC::pause()
{
ALWAYS_LOG(LOGIDENTIFIER);
- callOnMainThread([weakThis = makeWeakPtr(*this)] {
+ callOnMainThread([weakThis = createWeakPtr()] {
if (!weakThis)
return;
weakThis.get()->pauseInternal();
@@ -408,6 +407,7 @@
INFO_LOG(LOGIDENTIFIER, "time = ", time, ", negativeThreshold = ", negativeThreshold, ", positiveThreshold = ", positiveThreshold);
m_seeking = true;
+ auto weakThis = createWeakPtr();
m_pendingSeek = std::make_unique<PendingSeek>(time, negativeThreshold, positiveThreshold);
if (m_seekTimer.isActive())
@@ -858,6 +858,7 @@
return;
MediaTime duration = m_mediaSourcePrivate->duration();
+ auto weakThis = createWeakPtr();
NSArray* times = @[[NSValue valueWithCMTime:PAL::toCMTime(duration)]];
auto logSiteIdentifier = LOGIDENTIFIER;
@@ -864,7 +865,7 @@
DEBUG_LOG(logSiteIdentifier, duration);
UNUSED_PARAM(logSiteIdentifier);
- m_durationObserver = [m_synchronizer addBoundaryTimeObserverForTimes:times queue:dispatch_get_main_queue() usingBlock:[weakThis = makeWeakPtr(*this), duration, logSiteIdentifier, this] {
+ m_durationObserver = [m_synchronizer addBoundaryTimeObserverForTimes:times queue:dispatch_get_main_queue() usingBlock:[weakThis, duration, logSiteIdentifier, this] {
if (!weakThis)
return;
@@ -954,11 +955,6 @@
}
#endif
-CDMSessionMediaSourceAVFObjC* MediaPlayerPrivateMediaSourceAVFObjC::cdmSession() const
-{
- return m_session.get();
-}
-
void MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession(LegacyCDMSession* session)
{
if (session == m_session)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h (245862 => 245863)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -175,10 +175,13 @@
void flush(AVSampleBufferAudioRenderer *);
ALLOW_NEW_API_WITHOUT_GUARDS_END
+ WeakPtr<SourceBufferPrivateAVFObjC> createWeakPtr() { return m_weakFactory.createWeakPtr(*this); }
+
Vector<RefPtr<VideoTrackPrivateMediaSourceAVFObjC>> m_videoTracks;
Vector<RefPtr<AudioTrackPrivateMediaSourceAVFObjC>> m_audioTracks;
Vector<SourceBufferPrivateAVFObjCErrorClient*> m_errorClients;
+ WeakPtrFactory<SourceBufferPrivateAVFObjC> m_weakFactory;
WeakPtrFactory<SourceBufferPrivateAVFObjC> m_appendWeakFactory;
RetainPtr<AVStreamDataParser> m_parser;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (245862 => 245863)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2019-05-29 20:07:56 UTC (rev 245863)
@@ -465,8 +465,8 @@
SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC* parent)
: m_parser(adoptNS([PAL::allocAVStreamDataParserInstance() init]))
- , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:makeWeakPtr(*this)]))
- , m_errorListener(adoptNS([[WebAVSampleBufferErrorListener alloc] initWithParent:makeWeakPtr(*this)]))
+ , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()]))
+ , m_errorListener(adoptNS([[WebAVSampleBufferErrorListener alloc] initWithParent:createWeakPtr()]))
, m_isAppendingGroup(adoptOSObject(dispatch_group_create()))
, m_mediaSource(parent)
, m_mapID(nextMapID())
@@ -884,7 +884,7 @@
ALLOW_NEW_API_WITHOUT_GUARDS_END
if (!m_audioRenderers.contains(trackID)) {
renderer = adoptNS([PAL::allocAVSampleBufferAudioRendererInstance() init]);
- auto weakThis = makeWeakPtr(*this);
+ auto weakThis = createWeakPtr();
[renderer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{
if (weakThis)
weakThis->didBecomeReadyForMoreSamples(trackID);
@@ -920,7 +920,8 @@
}
if (m_hdcpError) {
- callOnMainThread([weakThis = makeWeakPtr(*this)] {
+ WeakPtr<SourceBufferPrivateAVFObjC> weakThis = createWeakPtr();
+ callOnMainThread([weakThis] {
if (!weakThis || !weakThis->m_session || !weakThis->m_hdcpError)
return;
@@ -1064,7 +1065,7 @@
if (m_decompressionSession) {
m_decompressionSession->flush();
- m_decompressionSession->notifyWhenHasAvailableVideoFrame([weakThis = makeWeakPtr(*this)] {
+ m_decompressionSession->notifyWhenHasAvailableVideoFrame([weakThis = createWeakPtr()] {
if (weakThis && weakThis->m_mediaSource)
weakThis->m_mediaSource->player()->setHasAvailableVideoFrame(true);
});
@@ -1137,7 +1138,7 @@
#endif
} else {
[m_displayLayer enqueueSampleBuffer:platformSample.sample.cmSampleBuffer];
- [m_displayLayer prerollDecodeWithCompletionHandler:[weakThis = makeWeakPtr(*this)] (BOOL success) mutable {
+ [m_displayLayer prerollDecodeWithCompletionHandler:[weakThis = createWeakPtr()] (BOOL success) mutable {
if (!success || !weakThis)
return;
@@ -1236,7 +1237,7 @@
});
}
if (m_displayLayer) {
- auto weakThis = makeWeakPtr(*this);
+ auto weakThis = createWeakPtr();
[m_displayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^ {
if (weakThis)
weakThis->didBecomeReadyForMoreSamples(trackID);
@@ -1243,7 +1244,7 @@
}];
}
} else if (m_audioRenderers.contains(trackID)) {
- auto weakThis = makeWeakPtr(*this);
+ auto weakThis = createWeakPtr();
[m_audioRenderers.get(trackID) requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^ {
if (weakThis)
weakThis->didBecomeReadyForMoreSamples(trackID);
@@ -1277,7 +1278,7 @@
m_displayLayer = layer;
if (m_displayLayer) {
- auto weakThis = makeWeakPtr(*this);
+ auto weakThis = createWeakPtr();
[m_displayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^ {
if (weakThis)
weakThis->didBecomeReadyForMoreSamples(m_enabledVideoTrackID);
@@ -1305,11 +1306,12 @@
if (!m_decompressionSession)
return;
- m_decompressionSession->requestMediaDataWhenReady([weakThis = makeWeakPtr(*this)] {
+ WeakPtr<SourceBufferPrivateAVFObjC> weakThis = createWeakPtr();
+ m_decompressionSession->requestMediaDataWhenReady([weakThis] {
if (weakThis)
weakThis->didBecomeReadyForMoreSamples(weakThis->m_enabledVideoTrackID);
});
- m_decompressionSession->notifyWhenHasAvailableVideoFrame([weakThis = makeWeakPtr(*this)] {
+ m_decompressionSession->notifyWhenHasAvailableVideoFrame([weakThis = createWeakPtr()] {
if (weakThis && weakThis->m_mediaSource)
weakThis->m_mediaSource->player()->setHasAvailableVideoFrame(true);
});
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (245862 => 245863)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -159,11 +159,6 @@
RenderBox::willBeDestroyed();
}
-RenderMultiColumnFlow* RenderBlockFlow::multiColumnFlowSlowCase() const
-{
- return rareBlockFlowData()->m_multiColumnFlow.get();
-}
-
RenderBlockFlow* RenderBlockFlow::previousSiblingWithOverhangingFloats(bool& parentHasFloats) const
{
// Attempt to locate a previous sibling with overhanging floats. We skip any elements that are
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (245862 => 245863)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -264,8 +264,7 @@
}
void layoutLineGridBox();
- RenderMultiColumnFlow* multiColumnFlow() const { return hasRareBlockFlowData() ? multiColumnFlowSlowCase() : nullptr; }
- RenderMultiColumnFlow* multiColumnFlowSlowCase() const;
+ RenderMultiColumnFlow* multiColumnFlow() const { return hasRareBlockFlowData() ? rareBlockFlowData()->m_multiColumnFlow.get() : nullptr; }
void setMultiColumnFlow(RenderMultiColumnFlow&);
void clearMultiColumnFlow();
bool willCreateColumns(Optional<unsigned> desiredColumnCount = WTF::nullopt) const;
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp (245862 => 245863)
--- trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlow.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -107,11 +107,6 @@
return nullptr;
}
-RenderMultiColumnSpannerPlaceholder* RenderMultiColumnFlow::findColumnSpannerPlaceholder(RenderBox* spanner) const
-{
- return m_spannerMap->get(spanner).get();
-}
-
void RenderMultiColumnFlow::layout()
{
ASSERT(!m_inLayout);
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h (245862 => 245863)
--- trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlow.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -48,7 +48,7 @@
static RenderBox* nextColumnSetOrSpannerSiblingOf(const RenderBox*);
static RenderBox* previousColumnSetOrSpannerSiblingOf(const RenderBox*);
- RenderMultiColumnSpannerPlaceholder* findColumnSpannerPlaceholder(RenderBox* spanner) const;
+ RenderMultiColumnSpannerPlaceholder* findColumnSpannerPlaceholder(RenderBox* spanner) const { return m_spannerMap->get(spanner).get(); }
void layout() override;
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (245862 => 245863)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -96,31 +96,6 @@
RenderTable::~RenderTable() = default;
-RenderTableSection* RenderTable::header() const
-{
- return m_head.get();
-}
-
-RenderTableSection* RenderTable::footer() const
-{
- return m_foot.get();
-}
-
-RenderTableSection* RenderTable::firstBody() const
-{
- return m_firstBody.get();
-}
-
-RenderTableSection* RenderTable::topSection() const
-{
- ASSERT(!needsSectionRecalc());
- if (m_head)
- return m_head.get();
- if (m_firstBody)
- return m_firstBody.get();
- return m_foot.get();
-}
-
void RenderTable::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderBlock::styleDidChange(diff, oldStyle);
Modified: trunk/Source/WebCore/rendering/RenderTable.h (245862 => 245863)
--- trunk/Source/WebCore/rendering/RenderTable.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebCore/rendering/RenderTable.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -152,9 +152,9 @@
m_columnPos[index] = position;
}
- RenderTableSection* header() const;
- RenderTableSection* footer() const;
- RenderTableSection* firstBody() const;
+ RenderTableSection* header() const { return m_head.get(); }
+ RenderTableSection* footer() const { return m_foot.get(); }
+ RenderTableSection* firstBody() const { return m_firstBody.get(); }
// This function returns 0 if the table has no section.
RenderTableSection* topSection() const;
@@ -370,6 +370,16 @@
bool m_inRecursiveSectionMovedWithPagination { false };
};
+inline RenderTableSection* RenderTable::topSection() const
+{
+ ASSERT(!needsSectionRecalc());
+ if (m_head)
+ return m_head.get();
+ if (m_firstBody)
+ return m_firstBody.get();
+ return m_foot.get();
+}
+
inline bool isDirectionSame(const RenderBox* tableItem, const RenderBox* otherTableItem) { return tableItem && otherTableItem ? tableItem->style().direction() == otherTableItem->style().direction() : true; }
inline RenderPtr<RenderBox> RenderTable::createAnonymousBoxWithSameTypeAs(const RenderBox& renderer) const
Modified: trunk/Source/WebKit/ChangeLog (245862 => 245863)
--- trunk/Source/WebKit/ChangeLog 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/ChangeLog 2019-05-29 20:07:56 UTC (rev 245863)
@@ -1,3 +1,15 @@
+2019-05-29 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r245857.
+
+ Breaks internal builds.
+
+ Reverted changeset:
+
+ "WeakPtr breaks vtables when upcasting to base classes"
+ https://bugs.webkit.org/show_bug.cgi?id=188799
+ https://trac.webkit.org/changeset/245857
+
2019-05-29 Chris Dumez <cdu...@apple.com>
[iOS] The WebContent process needs proper entitlement to do secure drawing
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (245862 => 245863)
--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -1016,11 +1016,6 @@
m_networkSession->notifyResourceLoadStatisticsProcessed();
}
-NetworkSession* WebResourceLoadStatisticsStore::networkSession()
-{
- return m_networkSession.get();
-}
-
void WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType> dataTypes, HashMap<RegistrableDomain, WebsiteDataToRemove>&& domainsToRemoveWebsiteDataFor, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&& completionHandler)
{
ASSERT(RunLoop::isMain());
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (245862 => 245863)
--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -175,7 +175,7 @@
void notifyResourceLoadStatisticsProcessed();
- NetworkSession* networkSession();
+ NetworkSession* networkSession() { return m_networkSession.get(); }
void sendDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned sigDigits, WebCore::ShouldSample) const;
void notifyPageStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins) const;
Modified: trunk/Source/WebKit/Shared/WebBackForwardListItem.cpp (245862 => 245863)
--- trunk/Source/WebKit/Shared/WebBackForwardListItem.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/Shared/WebBackForwardListItem.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -168,11 +168,6 @@
m_suspendedPage = makeWeakPtr(page);
}
-SuspendedPageProxy* WebBackForwardListItem::suspendedPage() const
-{
- return m_suspendedPage.get();
-}
-
void WebBackForwardListItem::removeSuspendedPageFromProcessPool()
{
if (!m_suspendedPage)
Modified: trunk/Source/WebKit/Shared/WebBackForwardListItem.h (245862 => 245863)
--- trunk/Source/WebKit/Shared/WebBackForwardListItem.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/Shared/WebBackForwardListItem.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -75,7 +75,7 @@
void setSnapshot(RefPtr<ViewSnapshot>&& snapshot) { m_itemState.snapshot = WTFMove(snapshot); }
#endif
void setSuspendedPage(SuspendedPageProxy*);
- SuspendedPageProxy* suspendedPage() const;
+ SuspendedPageProxy* suspendedPage() const { return m_suspendedPage.get(); }
#if !LOG_DISABLED
const char* loggingString();
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebResource.cpp (245862 => 245863)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebResource.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebResource.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -24,7 +24,6 @@
#include "WebFrameProxy.h"
#include "WebKitURIRequest.h"
#include "WebKitWebResourcePrivate.h"
-#include "WebPageProxy.h"
#include <glib/gi18n-lib.h>
#include <wtf/glib/GRefPtr.h>
#include <wtf/glib/WTFGType.h>
Modified: trunk/Source/WebKit/UIProcess/Authentication/cocoa/SecKeyProxyStore.h (245862 => 245863)
--- trunk/Source/WebKit/UIProcess/Authentication/cocoa/SecKeyProxyStore.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/UIProcess/Authentication/cocoa/SecKeyProxyStore.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -39,7 +39,7 @@
namespace WebKit {
-class SecKeyProxyStore : public RefCounted<SecKeyProxyStore>, public CanMakeWeakPtr<SecKeyProxyStore> {
+class SecKeyProxyStore : public RefCounted<SecKeyProxyStore> {
public:
static Ref<SecKeyProxyStore> create() { return adoptRef(* new SecKeyProxyStore()); }
@@ -47,10 +47,12 @@
bool isInitialized() const { return !!m_secKeyProxy; }
auto* get() const { return m_secKeyProxy.get(); }
+ auto& weakPtrFactory() const { return m_weakPtrFactory; }
private:
SecKeyProxyStore() = default;
+ WeakPtrFactory<SecKeyProxyStore> m_weakPtrFactory;
RetainPtr<SecKeyProxy> m_secKeyProxy;
};
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h (245862 => 245863)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorManager.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -49,7 +49,6 @@
using TransportSet = HashSet<WebCore::AuthenticatorTransport, WTF::IntHash<WebCore::AuthenticatorTransport>, WTF::StrongEnumHashTraits<WebCore::AuthenticatorTransport>>;
using AuthenticatorTransportService::Observer::weakPtrFactory;
- typedef AuthenticatorTransportService::Observer::WeakValueType WeakValueType;
AuthenticatorManager();
virtual ~AuthenticatorManager() = default;
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (245862 => 245863)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -1513,12 +1513,6 @@
send(Messages::WebProcess::SetHasSuspendedPageProxy(false), 0);
}
-WebProcessPool& WebProcessProxy::processPool() const
-{
- ASSERT(m_processPool);
- return *m_processPool.get();
-}
-
#if PLATFORM(WATCHOS)
void WebProcessProxy::takeBackgroundActivityTokenForFullscreenInput()
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (245862 => 245863)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2019-05-29 20:07:56 UTC (rev 245863)
@@ -119,7 +119,7 @@
void incrementSuspendedPageCount();
void decrementSuspendedPageCount();
- WebProcessPool& processPool() const;
+ WebProcessPool& processPool() const { ASSERT(m_processPool); return *m_processPool.get(); }
WebCore::RegistrableDomain registrableDomain() const { return m_registrableDomain.valueOr(WebCore::RegistrableDomain { }); }
void setIsInProcessCache(bool);
Modified: trunk/Tools/ChangeLog (245862 => 245863)
--- trunk/Tools/ChangeLog 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Tools/ChangeLog 2019-05-29 20:07:56 UTC (rev 245863)
@@ -1,3 +1,15 @@
+2019-05-29 Ryan Haddad <ryanhad...@apple.com>
+
+ Unreviewed, rolling out r245857.
+
+ Breaks internal builds.
+
+ Reverted changeset:
+
+ "WeakPtr breaks vtables when upcasting to base classes"
+ https://bugs.webkit.org/show_bug.cgi?id=188799
+ https://trac.webkit.org/changeset/245857
+
2019-05-28 Geoffrey Garen <gga...@apple.com>
WeakPtr breaks vtables when upcasting to base classes
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp (245862 => 245863)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp 2019-05-29 19:37:14 UTC (rev 245862)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp 2019-05-29 20:07:56 UTC (rev 245863)
@@ -25,31 +25,16 @@
#include "config.h"
-static unsigned s_baseWeakReferences = 0;
-
-#define DID_CREATE_WEAK_REFERENCE(p) do { \
- ++s_baseWeakReferences; \
-} while (0);
-
-#define WILL_DESTROY_WEAK_REFERENCE(p) do { \
- --s_baseWeakReferences; \
-} while (0);
-
#include "Test.h"
#include <wtf/HashSet.h>
#include <wtf/WeakHashSet.h>
#include <wtf/WeakPtr.h>
+static unsigned s_baseWeakReferences = 0;
+
namespace TestWebKitAPI {
-struct Int : public CanMakeWeakPtr<Int> {
- Int(int i) : m_i(i) { }
- operator int() const { return m_i; }
- bool operator==(const Int& other) const { return m_i == other.m_i; }
- int m_i;
-};
-
-class Base : public CanMakeWeakPtr<Base> {
+class Base {
public:
Base() { }
@@ -58,7 +43,10 @@
return 0;
}
- int dummy; // Prevent empty base class optimization, to make testing more interesting.
+ auto& weakPtrFactory() const { return m_weakPtrFactory; }
+
+private:
+ WeakPtrFactory<Base> m_weakPtrFactory;
};
class Derived : public Base {
@@ -65,8 +53,6 @@
public:
Derived() { }
- virtual ~Derived() { } // Force a pointer fixup when casting Base <-> Derived
-
int foo()
{
return 1;
@@ -75,15 +61,31 @@
}
+namespace WTF {
+
+template<>
+WeakReference<TestWebKitAPI::Base>::WeakReference(TestWebKitAPI::Base* ptr)
+ : m_ptr(ptr)
+{
+ ++s_baseWeakReferences;
+}
+template<>
+WeakReference<TestWebKitAPI::Base>::~WeakReference()
+{
+ --s_baseWeakReferences;
+}
+
+}
+
namespace TestWebKitAPI {
TEST(WTF_WeakPtr, Basic)
{
- Int dummy(5);
- WeakPtrFactory<Int>* factory = new WeakPtrFactory<Int>();
- WeakPtr<Int> weakPtr1 = factory->createWeakPtr(dummy);
- WeakPtr<Int> weakPtr2 = factory->createWeakPtr(dummy);
- WeakPtr<Int> weakPtr3 = factory->createWeakPtr(dummy);
+ int dummy = 5;
+ WeakPtrFactory<int>* factory = new WeakPtrFactory<int>();
+ WeakPtr<int> weakPtr1 = factory->createWeakPtr(dummy);
+ WeakPtr<int> weakPtr2 = factory->createWeakPtr(dummy);
+ WeakPtr<int> weakPtr3 = factory->createWeakPtr(dummy);
EXPECT_EQ(weakPtr1.get(), &dummy);
EXPECT_EQ(weakPtr2.get(), &dummy);
EXPECT_EQ(weakPtr3.get(), &dummy);
@@ -104,10 +106,10 @@
TEST(WTF_WeakPtr, Assignment)
{
- Int dummy(5);
- WeakPtr<Int> weakPtr;
+ int dummy = 5;
+ WeakPtr<int> weakPtr;
{
- WeakPtrFactory<Int> factory;
+ WeakPtrFactory<int> factory;
EXPECT_NULL(weakPtr.get());
weakPtr = factory.createWeakPtr(dummy);
EXPECT_EQ(weakPtr.get(), &dummy);
@@ -117,12 +119,12 @@
TEST(WTF_WeakPtr, MultipleFactories)
{
- Int dummy1(5);
- Int dummy2(7);
- WeakPtrFactory<Int>* factory1 = new WeakPtrFactory<Int>();
- WeakPtrFactory<Int>* factory2 = new WeakPtrFactory<Int>();
- WeakPtr<Int> weakPtr1 = factory1->createWeakPtr(dummy1);
- WeakPtr<Int> weakPtr2 = factory2->createWeakPtr(dummy2);
+ int dummy1 = 5;
+ int dummy2 = 7;
+ WeakPtrFactory<int>* factory1 = new WeakPtrFactory<int>();
+ WeakPtrFactory<int>* factory2 = new WeakPtrFactory<int>();
+ WeakPtr<int> weakPtr1 = factory1->createWeakPtr(dummy1);
+ WeakPtr<int> weakPtr2 = factory2->createWeakPtr(dummy2);
EXPECT_EQ(weakPtr1.get(), &dummy1);
EXPECT_EQ(weakPtr2.get(), &dummy2);
EXPECT_TRUE(weakPtr1 != weakPtr2);
@@ -137,11 +139,11 @@
TEST(WTF_WeakPtr, RevokeAll)
{
- Int dummy(5);
- WeakPtrFactory<Int> factory;
- WeakPtr<Int> weakPtr1 = factory.createWeakPtr(dummy);
- WeakPtr<Int> weakPtr2 = factory.createWeakPtr(dummy);
- WeakPtr<Int> weakPtr3 = factory.createWeakPtr(dummy);
+ int dummy = 5;
+ WeakPtrFactory<int> factory;
+ WeakPtr<int> weakPtr1 = factory.createWeakPtr(dummy);
+ WeakPtr<int> weakPtr2 = factory.createWeakPtr(dummy);
+ WeakPtr<int> weakPtr3 = factory.createWeakPtr(dummy);
EXPECT_EQ(weakPtr1.get(), &dummy);
EXPECT_EQ(weakPtr2.get(), &dummy);
EXPECT_EQ(weakPtr3.get(), &dummy);
@@ -151,7 +153,7 @@
EXPECT_NULL(weakPtr3.get());
}
-struct Foo : public CanMakeWeakPtr<Foo> {
+struct Foo {
void bar() { };
};
@@ -183,13 +185,13 @@
TEST(WTF_WeakPtr, Forget)
{
- Int dummy(5);
- Int dummy2(7);
+ int dummy = 5;
+ int dummy2 = 7;
- WeakPtrFactory<Int> outerFactory;
- WeakPtr<Int> weakPtr1, weakPtr2, weakPtr3, weakPtr4;
+ WeakPtrFactory<int> outerFactory;
+ WeakPtr<int> weakPtr1, weakPtr2, weakPtr3, weakPtr4;
{
- WeakPtrFactory<Int> innerFactory;
+ WeakPtrFactory<int> innerFactory;
weakPtr1 = innerFactory.createWeakPtr(dummy);
weakPtr2 = innerFactory.createWeakPtr(dummy);
weakPtr3 = innerFactory.createWeakPtr(dummy);
@@ -215,7 +217,7 @@
EXPECT_EQ(weakPtr2.get(), &dummy);
EXPECT_EQ(weakPtr4.get(), &dummy);
- WeakPtr<Int> weakPtr5 = weakPtr2;
+ WeakPtr<int> weakPtr5 = weakPtr2;
EXPECT_EQ(weakPtr2.get(), &dummy);
EXPECT_EQ(weakPtr5.get(), &dummy);
weakPtr5.clear();
@@ -231,16 +233,16 @@
EXPECT_NULL(weakPtr2.get());
EXPECT_EQ(weakPtr4.get(), &dummy2);
- WeakPtr<Int> weakPtr5 = weakPtr4;
+ WeakPtr<int> weakPtr5 = weakPtr4;
EXPECT_EQ(weakPtr4.get(), &dummy2);
EXPECT_EQ(weakPtr5.get(), &dummy2);
weakPtr5.clear();
EXPECT_NULL(weakPtr5.get());
- WeakPtr<Int> weakPtr6 = weakPtr5;
+ WeakPtr<int> weakPtr6 = weakPtr5;
EXPECT_NULL(weakPtr6.get());
EXPECT_EQ(weakPtr5.get(), weakPtr6.get());
- WeakPtr<Int> weakPtr7 = outerFactory.createWeakPtr(dummy2);
+ WeakPtr<int> weakPtr7 = outerFactory.createWeakPtr(dummy2);
EXPECT_EQ(weakPtr7.get(), &dummy2);
weakPtr7 = nullptr;
EXPECT_NULL(weakPtr7.get());
@@ -248,8 +250,8 @@
TEST(WTF_WeakPtr, Downcasting)
{
- int dummy0(0);
- int dummy1(1);
+ int dummy0 = 0;
+ int dummy1 = 1;
WeakPtr<Base> baseWeakPtr;
WeakPtr<Derived> derivedWeakPtr;