WebKit Bugzilla
Attachment 373760 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), 1.38 KB, created by
Chris Dumez
on 2019-07-09 14:02:41 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-07-09 14:02:41 PDT
Size:
1.38 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 {
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
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