[webkit-dev] Why Page::setMainFrame use PassRefPtr type parameter?
Darin Adler
darin at apple.com
Thu Dec 3 17:12:32 PST 2009
On Nov 28, 2009, at 12:09 AM, pattin.shieh wrote:
> Look at this:void Page::setMainFrame(PassRefPtr<Frame> mainFrame). Why use PassRefPtr?
Because the only call to Page::setMainFrame is inside the Frame constructor, there is no performance benefit to taking a PassRefPtr.
But it’s arguably a good practice for a function that takes ownership of its argument to take a PassRefPtr even in cases where there is no performance benefit. It’s how the function states that it will keep a reference.
-- Darin
More information about the webkit-dev
mailing list