[webkit-reviews] review granted: [Bug 121154] OwnPtr: Use copy/move-and-swap for assignment operators : [Attachment 211306] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 11 07:18:03 PDT 2013


Anders Carlsson <andersca at apple.com> has granted Mikhail Pozdnyakov
<mikhail.pozdnyakov at intel.com>'s request for review:
Bug 121154: OwnPtr: Use copy/move-and-swap for assignment operators
https://bugs.webkit.org/show_bug.cgi?id=121154

Attachment 211306: patch
https://bugs.webkit.org/attachment.cgi?id=211306&action=review

------- Additional Comments from Anders Carlsson <andersca at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=211306&action=review


> Source/WTF/wtf/OwnPtr.h:140
> -	   PtrType ptr = m_ptr;
> -	   m_ptr = o.leakPtr();
> -	   ASSERT(!ptr || m_ptr != ptr);
> -	   deleteOwnedPtr(ptr);
> +	   ASSERT(!o || o != m_ptr);
> +	   OwnPtr ptr = o;
> +	   swap(ptr);

I wouldn't worry about modifying PassOwnPtr since then plan is to get rid of
it.

> Source/WTF/wtf/OwnPtr.h:148
> -	   PtrType ptr = m_ptr;
> -	   m_ptr = o.leakPtr();
> -	   ASSERT(!ptr || m_ptr != ptr);
> -	   deleteOwnedPtr(ptr);
> +	   ASSERT(!o || o != m_ptr);
> +	   OwnPtr ptr = o;
> +	   swap(ptr);

Ditto.

> Source/WTF/wtf/OwnPtr.h:166
> +	   OwnPtr ptr = std::move(o);

Can just use auto here.

> Source/WTF/wtf/OwnPtr.h:174
> +	   OwnPtr ptr = std::move(o);

Ditto.


More information about the webkit-reviews mailing list