OwnPtr holds a pointer and calls "delete" on that pointer when it goes out of scope. Just like RefPtr, you can .release() the pointer from an OwnPtr, into a PassRefPtr. PassOwnPtr functions similarly to an OwnPtr (in that it will delete its pointer when it goes out of scope) except when you assign a PassOwnPtr to another OwnPtr it gives up its pointer (.release()s itself).
Think of OwnPtr like RefPtr, except for singularly-owned objects instead of reference-counted objects. Think of PassOwnPtr as OwnPtr's analog to PassRefPtr. See the original files for more information: http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/OwnArrayPtr.h http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/OwnFastMallocPtr.h http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/OwnPtr.h http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/OwnPtrCommon.h http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/PassOwnArrayPtr.h http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/PassOwnPtr.h http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/PassRefPtr.h http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/PassTraits.h On Tue, Dec 13, 2011 at 3:18 AM, Paul Hsu <[email protected]> wrote: > Hi all, > > I'm a newbie in webkit development. > > I found a great article about 'RefPtr and PassRefPtr' here. > http://www.webkit.org/coding/RefPtr.html > > But there's no document about 'OwnPtr and PassOwnPtr'. > > I would like to ask what's the difference RefPtr and OwnPtr? > > How to use OwnPtr and PassOwnPtr? > > Need your help. > > -- > Paul Hsu > [email protected] > > _______________________________________________ > webkit-dev mailing list > [email protected] > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > _______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

