Title: [268543] trunk/Source/WTF
- Revision
- 268543
- Author
- [email protected]
- Date
- 2020-10-15 12:12:02 -0700 (Thu, 15 Oct 2020)
Log Message
WeakObjCPtr.h is not safe to include in C++ source files
<https://webkit.org/b/217712>
<rdar://problem/70250667>
Reviewed by Darin Adler.
* wtf/WeakObjCPtr.h:
(WTF::WeakObjCPtr::get const):
- Move implementation outside of the class and wrap it in
#ifdef __OBJC__/#endif. This makes the header safe to compile
with other C++ sources, but will fail if get() is used in a
C++ source file.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (268542 => 268543)
--- trunk/Source/WTF/ChangeLog 2020-10-15 19:09:01 UTC (rev 268542)
+++ trunk/Source/WTF/ChangeLog 2020-10-15 19:12:02 UTC (rev 268543)
@@ -1,3 +1,18 @@
+2020-10-15 David Kilzer <[email protected]>
+
+ WeakObjCPtr.h is not safe to include in C++ source files
+ <https://webkit.org/b/217712>
+ <rdar://problem/70250667>
+
+ Reviewed by Darin Adler.
+
+ * wtf/WeakObjCPtr.h:
+ (WTF::WeakObjCPtr::get const):
+ - Move implementation outside of the class and wrap it in
+ #ifdef __OBJC__/#endif. This makes the header safe to compile
+ with other C++ sources, but will fail if get() is used in a
+ C++ source file.
+
2020-10-14 Ryosuke Niwa <[email protected]>
Unreviewed build fix. Disable IPC testing API on non-Cocoa platforms.
Modified: trunk/Source/WTF/wtf/WeakObjCPtr.h (268542 => 268543)
--- trunk/Source/WTF/wtf/WeakObjCPtr.h 2020-10-15 19:09:01 UTC (rev 268542)
+++ trunk/Source/WTF/wtf/WeakObjCPtr.h 2020-10-15 19:12:02 UTC (rev 268543)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -81,14 +81,7 @@
return !get();
}
- RetainPtr<ValueType> get() const
- {
-#if __has_feature(objc_arc)
- return static_cast<ValueType *>(m_weakReference);
-#else
- return adoptNS(objc_loadWeakRetained(&m_weakReference));
-#endif
- }
+ RetainPtr<ValueType> get() const;
ValueType *getAutoreleased() const
{
@@ -110,6 +103,18 @@
#endif
};
+#ifdef __OBJC__
+template<typename T>
+RetainPtr<typename WeakObjCPtr<T>::ValueType> WeakObjCPtr<T>::get() const
+{
+#if __has_feature(objc_arc)
+ return static_cast<typename WeakObjCPtr<T>::ValueType *>(m_weakReference);
+#else
+ return adoptNS(objc_loadWeakRetained(&m_weakReference));
+#endif
+}
+#endif
+
} // namespace WTF
using WTF::WeakObjCPtr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes