Port JNI class from Lime legacy
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef LIME_UTILS_JNI_H
|
||||
#define LIME_UTILS_JNI_H
|
||||
#ifndef LIME_SYSTEM_JNI_H
|
||||
#define LIME_SYSTEM_JNI_H
|
||||
|
||||
|
||||
namespace lime {
|
||||
@@ -8,10 +8,6 @@ namespace lime {
|
||||
class Object {
|
||||
|
||||
|
||||
public:
|
||||
|
||||
int ref_count;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Object () {}
|
||||
@@ -28,6 +24,25 @@ namespace lime {
|
||||
|
||||
}
|
||||
|
||||
Object *IncRef () {
|
||||
|
||||
ref_count++;
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
void DecRef () {
|
||||
|
||||
ref_count--;
|
||||
|
||||
if (ref_count <= 0) {
|
||||
|
||||
delete this;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void drop () {
|
||||
|
||||
ref_count--;
|
||||
@@ -37,6 +52,8 @@ namespace lime {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int ref_count;
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user