Bug 121154

Summary: OwnPtr: Use copy/move-and-swap for assignment operators
Product: WebKit Reporter: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Component: Web Template FrameworkAssignee: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, benjamin, cmarcelo, commit-queue, darin, kling
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch andersca: review+, andersca: commit-queue-

Mikhail Pozdnyakov
Reported 2013-09-11 05:17:57 PDT
Rationals: - decrease of repeated code - consistency with RefPtr
Attachments
patch (2.36 KB, patch)
2013-09-11 06:33 PDT, Mikhail Pozdnyakov
andersca: review+
andersca: commit-queue-
Mikhail Pozdnyakov
Comment 1 2013-09-11 06:33:59 PDT
Anders Carlsson
Comment 2 2013-09-11 07:17:16 PDT
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.
Mikhail Pozdnyakov
Comment 3 2013-09-11 07:32:22 PDT
Note You need to log in before you can comment on or make changes to this bug.