20 #include "RefCounted.h"
21 #include "AtomicInteger.h"
22 #include "JNIHelper.h"
27 namespace com {
namespace avpkit {
namespace ferry {
29 RefCounted :: RefCounted()
35 RefCounted :: ~RefCounted()
41 JNIHelper::sDeleteGlobalRef((jobject)
mAllocator);
49 JNIHelper::sDeleteGlobalRef((jobject)
mAllocator);
51 mAllocator = JNIHelper::sNewGlobalRef((jobject)allocator);
73 int32_t retval =
mRefCount->decrementAndGet();
Parent of all Ferry objects – it mains reference counts in native code.
virtual int32_t acquire()
Internal Only.
virtual void destroy()
This method is called by RefCounted objects when their Ref Count reaches zero and they are about to b...
void * mAllocator
Not part of public API.
void * getJavaAllocator()
This method is public but not part of the standard API.
virtual int32_t release()
Internal Only.
virtual RefCounted * copyReference()
Create a new Java object that refers to the same native object.
virtual int32_t getCurrentRefCount()
Return the current reference count on this object.
void setJavaAllocator(void *allocator)
This method is public but not part of the standard API.
AtomicInteger * mRefCount
This is the internal reference count, represented as an AtomicInteger to make sure it is thread safe.
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...