class RefBase

Defined at line 282 of file ../../third_party/android/platform/system/core/include/utils/RefBase.h

---------------------------------------------------------------------------

Public Methods

void incStrong (const void * id)
void incStrongRequireStrong (const void * id)
void decStrong (const void * id)
void forceIncStrong (const void * id)
int32_t getStrongCount ()

DEBUGGING ONLY: Get current strong ref count.

weakref_type * createWeak (const void * id)
weakref_type * getWeakRefs ()
void printRefs ()

DEBUGGING ONLY: Print references held on object.

Defined at line 332 of file ../../third_party/android/platform/system/core/include/utils/RefBase.h

void trackMe (bool enable, bool retain)

DEBUGGING ONLY: Enable tracking of object.

Defined at line 335 of file ../../third_party/android/platform/system/core/include/utils/RefBase.h

Protected Methods

void RefBase ()

When constructing these objects, prefer using sp::make

<

>. Using a RefBase

object on the stack or with other refcount mechanisms (e.g.

std::shared_ptr) is inherently wrong. RefBase types have an implicit

ownership model and cannot be safely used with other ownership models.

void ~RefBase ()
void extendObjectLifetime (int32_t mode)
void onFirstRef ()

Invoked after creation of initial strong pointer/reference.

void onLastStrongRef (const void * id)

Invoked when either the last strong reference goes away, or we need to undo

the effect of an unnecessary onIncStrongAttempted.

bool onIncStrongAttempted (uint32_t flags, const void * id)

Only called in OBJECT_LIFETIME_WEAK case. Returns true if OK to promote to

strong reference. May have side effects if it returns true.

The first flags argument is always FIRST_INC_STRONG.

TODO: Remove initial flag argument.

void onLastWeakRef (const void * id)

Invoked in the OBJECT_LIFETIME_WEAK case when the last reference of either

kind goes away. Unused.

TODO: Remove.

Enumerations

enum 
Name Value
OBJECT_LIFETIME_STRONG 0x0000
OBJECT_LIFETIME_WEAK 0x0001
OBJECT_LIFETIME_MASK 0x0001

Flags for extendObjectLifetime()

Defined at line 350 of file ../../third_party/android/platform/system/core/include/utils/RefBase.h

enum 
Name Value
FIRST_INC_STRONG 0x0001

Flags for onIncStrongAttempted()

Defined at line 359 of file ../../third_party/android/platform/system/core/include/utils/RefBase.h

Records

Friends

class ReferenceMover
class weakref_type