Look at this:void Page::setMainFrame(PassRefPtr<Frame> mainFrame).
Why use PassRefPtr? Infact,change to following will work same:
void Page::setMainFrame(Frame *mainFrame)
1).Look into the function source code:
m_mainFrame = mainFrame; --> call "operator=(T* optr)",reference count +1
It mean that if change to "Frame *mainFrame" ,will call mainFrame->ref();
2).Using "PassRefPtr<Frame> mainFrame":
m_mainFrame = mainFrame; --> call "operator=(const PassRefPtr<T>& o)",reference count no change
But,reference count was changed when the function is called:
page->setMainFrame(this); --> call "PassRefPtr(T* ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }", reference count +1
So,The "PassRefPtr<Frame> mainFrame" and the "Frame *mainFrame" cause same reference count.
But use "PassRefPtr<Frame>" will call new operation!