WebKit Bugzilla
Attachment 373495 Details for
Bug 199517
: Add threading assertion to WTF::WeakPtr
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP Patch
199517_wip.patch (text/plain), 1.17 KB, created by
Chris Dumez
on 2019-07-05 08:29:18 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-07-05 08:29:18 PDT
Size:
1.17 KB
patch
obsolete
>diff --git a/Source/WTF/wtf/WeakPtr.h b/Source/WTF/wtf/WeakPtr.h >index 7f108a713a4..e9a5284ef53 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> >@@ -61,20 +62,27 @@ public: > > template<typename T> typename T::WeakValueType* get() > { >+ RELEASE_ASSERT(m_wasConstructedOnMainThread == isMainThread()); // FIXME: Make it a debug ASSERT(). > return static_cast<typename T::WeakValueType*>(m_ptr); > } > >- explicit operator bool() const { return m_ptr; } >+ explicit operator bool() const >+ { >+ RELEASE_ASSERT(m_wasConstructedOnMainThread == isMainThread()); // FIXME: Make it a debug ASSERT(). >+ return m_ptr; >+ } > void clear() { m_ptr = nullptr; } > > private: > template<typename T> explicit WeakPtrImpl(T* ptr) > : m_ptr(static_cast<typename T::WeakValueType*>(ptr)) >+ , m_wasConstructedOnMainThread(isMainThread()) > { > DID_CREATE_WEAK_PTR_IMPL(ptr); > } > > void* m_ptr; >+ bool m_wasConstructedOnMainThread; > }; > > template<typename T>
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 199517
:
373494
|
373495
|
373501
|
373502
|
373503
|
373505
|
373508
|
373626
|
373633
|
373634
|
373636
|
373638
|
373656
|
373684
|
373685
|
373686
|
373687
|
373747
|
373757
|
373759
|
373773
|
373783
|
373786
|
373794
|
373804
|
373809
|
373845
|
374012
|
374015
|
374017
|
374022