WebKit Bugzilla
Attachment 373762 Details for
Bug 199639
: Add threading assertion to WeakPtrFactory::createWeakPtr()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP Patch
199639_wip.patch (text/plain), 2.36 KB, created by
Chris Dumez
on 2019-07-09 14:07:03 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-07-09 14:07:03 PDT
Size:
2.36 KB
patch
obsolete
>diff --git a/Source/WTF/wtf/WeakPtr.h b/Source/WTF/wtf/WeakPtr.h >index 7f108a713a4..62677e80e8f 100644 >--- a/Source/WTF/wtf/WeakPtr.h >+++ b/Source/WTF/wtf/WeakPtr.h >@@ -26,6 +26,7 @@ > > #pragma once > >+#include <wtf/MainThread.h> > #include <wtf/Noncopyable.h> > #include <wtf/Ref.h> > #include <wtf/ThreadSafeRefCounted.h> >@@ -114,7 +115,11 @@ class WeakPtrFactory { > WTF_MAKE_NONCOPYABLE(WeakPtrFactory<T>); > WTF_MAKE_FAST_ALLOCATED; > public: >- WeakPtrFactory() = default; >+ WeakPtrFactory() >+ : m_wasConstructedOnMainThread(isMainThread()) >+ { >+ } >+ > ~WeakPtrFactory() > { > if (!m_impl) >@@ -124,6 +129,7 @@ public: > > WeakPtr<T> createWeakPtr(T& object) const > { >+ RELEASE_ASSERT(m_wasConstructedOnMainThread == isMainThread()); // FIXME: Make it a debug ASSERT(). > if (!m_impl) > m_impl = WeakPtrImpl::create(&object); > >@@ -133,6 +139,7 @@ public: > > WeakPtr<const T> createWeakPtr(const T& object) const > { >+ RELEASE_ASSERT(m_wasConstructedOnMainThread == isMainThread()); // FIXME: Make it a debug ASSERT(). > if (!m_impl) > m_impl = WeakPtrImpl::create(const_cast<T*>(&object)); > >@@ -153,6 +160,7 @@ private: > template<typename> friend class WeakHashSet; > > mutable RefPtr<WeakPtrImpl> m_impl; >+ bool m_wasConstructedOnMainThread; > }; > > template<typename T> class CanMakeWeakPtr { >diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp >index c8882ee2305..58d214a800f 100644 >--- a/Source/WebCore/platform/ScrollableArea.cpp >+++ b/Source/WebCore/platform/ScrollableArea.cpp >@@ -47,6 +47,7 @@ namespace WebCore { > > struct SameSizeAsScrollableArea { > virtual ~SameSizeAsScrollableArea(); >+ bool weakPtrDebug; > #if ENABLE(CSS_SCROLL_SNAP) > void* pointers[3]; > unsigned currentIndices[2]; >diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp >index 78c0958db31..27b3389c660 100644 >--- a/Source/WebCore/rendering/RenderObject.cpp >+++ b/Source/WebCore/rendering/RenderObject.cpp >@@ -102,6 +102,7 @@ RenderObject::SetLayoutNeededForbiddenScope::~SetLayoutNeededForbiddenScope() > > struct SameSizeAsRenderObject { > virtual ~SameSizeAsRenderObject() = default; // Allocate vtable pointer. >+ bool weakPtrDebug; > void* pointers[5]; > #ifndef NDEBUG > unsigned m_debugBitfields : 2;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199639
:
373760
|
373762
|
373784
|
373785
|
373788
|
373790
|
373796
|
373844
|
373860
|
373873
|
373891
|
373925
|
373969
|
374011
|
374021
|
374078
|
374080