Rationals: - decrease of repeated code - consistency with RefPtr
Created attachment 211306 [details] patch
Comment on attachment 211306 [details] patch 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.
Committed r155526: <http://trac.webkit.org/changeset/155526>