Title: [222741] trunk/Source
- Revision
- 222741
- Author
- [email protected]
- Date
- 2017-10-02 14:31:16 -0700 (Mon, 02 Oct 2017)
Log Message
Add makeWeakPtr variant that takes pointer
https://bugs.webkit.org/show_bug.cgi?id=177767
Reviewed by Zalan Bujtas.
Source/WebCore:
Use it.
* rendering/SelectionRangeData.h:
(WebCore::SelectionRangeData::Context::Context):
Source/WTF:
* wtf/WeakPtr.h:
(WTF::makeWeakPtr):
This version deals with the nullptr.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (222740 => 222741)
--- trunk/Source/WTF/ChangeLog 2017-10-02 21:06:32 UTC (rev 222740)
+++ trunk/Source/WTF/ChangeLog 2017-10-02 21:31:16 UTC (rev 222741)
@@ -1,3 +1,15 @@
+2017-10-02 Antti Koivisto <[email protected]>
+
+ Add makeWeakPtr variant that takes pointer
+ https://bugs.webkit.org/show_bug.cgi?id=177767
+
+ Reviewed by Zalan Bujtas.
+
+ * wtf/WeakPtr.h:
+ (WTF::makeWeakPtr):
+
+ This version deals with the nullptr.
+
2017-09-30 Antti Koivisto <[email protected]>
Add makeWeakPtr for easier WeakPtr construction
Modified: trunk/Source/WTF/wtf/WeakPtr.h (222740 => 222741)
--- trunk/Source/WTF/wtf/WeakPtr.h 2017-10-02 21:06:32 UTC (rev 222740)
+++ trunk/Source/WTF/wtf/WeakPtr.h 2017-10-02 21:31:16 UTC (rev 222741)
@@ -126,6 +126,13 @@
return ref.weakPtrFactory().template createWeakPtr<T>(ref);
}
+template <typename T> inline WeakPtr<T> makeWeakPtr(T* ptr)
+{
+ if (!ptr)
+ return { };
+ return makeWeakPtr(*ptr);
+}
+
template<typename T, typename U> inline bool operator==(const WeakPtr<T>& a, const WeakPtr<U>& b)
{
return a.get() == b.get();
Modified: trunk/Source/WebCore/ChangeLog (222740 => 222741)
--- trunk/Source/WebCore/ChangeLog 2017-10-02 21:06:32 UTC (rev 222740)
+++ trunk/Source/WebCore/ChangeLog 2017-10-02 21:31:16 UTC (rev 222741)
@@ -1,5 +1,17 @@
2017-10-02 Antti Koivisto <[email protected]>
+ Add makeWeakPtr variant that takes pointer
+ https://bugs.webkit.org/show_bug.cgi?id=177767
+
+ Reviewed by Zalan Bujtas.
+
+ Use it.
+
+ * rendering/SelectionRangeData.h:
+ (WebCore::SelectionRangeData::Context::Context):
+
+2017-10-02 Antti Koivisto <[email protected]>
+
Make RenderPtr a type alias of std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=177739
Modified: trunk/Source/WebCore/rendering/SelectionRangeData.h (222740 => 222741)
--- trunk/Source/WebCore/rendering/SelectionRangeData.h 2017-10-02 21:06:32 UTC (rev 222740)
+++ trunk/Source/WebCore/rendering/SelectionRangeData.h 2017-10-02 21:31:16 UTC (rev 222741)
@@ -48,8 +48,8 @@
public:
Context() = default;
Context(RenderObject* start, RenderObject* end, unsigned startOffset, unsigned endOffset)
- : m_start(start ? makeWeakPtr(*start) : nullptr)
- , m_end(end ? makeWeakPtr(*end) : nullptr)
+ : m_start(makeWeakPtr(start))
+ , m_end(makeWeakPtr(end))
, m_startPosition(startOffset)
, m_endPosition(endOffset)
{
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes