Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Unified Diff: third_party/WebKit/Source/wtf/WeakPtr.h

Issue 2371663002: Introduce an injection point to configure the internal pointer of WeakPtr
Patch Set: fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Persistent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/WeakPtr.h
diff --git a/third_party/WebKit/Source/wtf/WeakPtr.h b/third_party/WebKit/Source/wtf/WeakPtr.h
index 5b790e4055a5880e374d02f88fb56bc048eab843..69a800a761e2dff26f2038c37303466a8b08e303 100644
--- a/third_party/WebKit/Source/wtf/WeakPtr.h
+++ b/third_party/WebKit/Source/wtf/WeakPtr.h
@@ -31,30 +31,34 @@
namespace WTF {
-template<typename T>
-using WeakPtr = base::WeakPtr<T>;
+template <typename T, typename Traits = base::DefaultWeakPtrTraits>
+using WeakPtr = base::WeakPtr<T, Traits>;
+
+template <typename T, typename Traits = base::DefaultWeakPtrTraits>
+class WeakPtrFactory : public base::WeakPtrFactory<T, Traits> {
+ WTF_MAKE_NONCOPYABLE(WeakPtrFactory);
+ DISALLOW_NEW();
+
+private:
+ using Base = base::WeakPtrFactory<T, Traits>;
-template<typename T>
-class WeakPtrFactory {
- WTF_MAKE_NONCOPYABLE(WeakPtrFactory<T>);
- USING_FAST_MALLOC(WeakPtrFactory);
public:
- explicit WeakPtrFactory(T* ptr) : m_factory(ptr) { }
+ explicit WeakPtrFactory(T* ptr)
+ : Base(ptr)
+ {
+ }
- WeakPtr<T> createWeakPtr() { return m_factory.GetWeakPtr(); }
+ WeakPtr<T, Traits> createWeakPtr() { return this->GetWeakPtr(); }
void revokeAll()
{
- m_factory.InvalidateWeakPtrs();
+ this->InvalidateWeakPtrs();
}
bool hasWeakPtrs() const
{
- return m_factory.HasWeakPtrs();
+ return this->HasWeakPtrs();
}
-
-private:
- base::WeakPtrFactory<T> m_factory;
};
} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Persistent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698