Yes the first strong reference acquired on a RefBase causes onFirstRef() to
be called.  The sp<> class automatically acquires (and releases) the
reference for you.

On Wed, Feb 3, 2010 at 2:45 AM, void* main <[email protected]> wrote:

> Hi, all.
>
> I'm watching the initiating process of SurfaceFlinger(frameworks/
> base/
> libs/surfaceflinger/SurfaceFlinger.cpp).
>
> void SurfaceFlinger::instantiate() {
>    defaultServiceManager()->addService(
>            String16("SurfaceFlinger"), new SurfaceFlinger());
> }
>
>
> I know the Threads::run method is invoked at onFirstRef function.
> And SurfaceFlinger::onFirstRef() function is called by
> RefBase::incStrong.
> But I don't know how exactly RefBase::incStrong method is invoked.
> SurfaceFlinger class is derived from the RefBase calss.
> (SurfaceFlinger -> BnSurfaceComposer -> ISurfaceComposer ->
> IInterface
> -> RefBase)
> Is there any constructor using RefBase::incStrong method?
> Is it related with strong pointer template(<sp>)?
>
> template<typename T> template<typename U>
> sp<T>::sp(U* other) : m_ptr(other)
> {
>    if (other) other->incStrong(this);
>
>
> --
> unsubscribe: 
> [email protected]<android-porting%[email protected]>
> website: http://groups.google.com/group/android-porting
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to