summaryrefslogtreecommitdiffstats
path: root/V8Binding/jni/jni_instance.h
diff options
context:
space:
mode:
Diffstat (limited to 'V8Binding/jni/jni_instance.h')
-rw-r--r--V8Binding/jni/jni_instance.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/V8Binding/jni/jni_instance.h b/V8Binding/jni/jni_instance.h
index 94706c8..f8b0d65 100644
--- a/V8Binding/jni/jni_instance.h
+++ b/V8Binding/jni/jni_instance.h
@@ -30,6 +30,7 @@
#include "jni_utility_private.h"
#include <JavaVM/jni.h>
+#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace android {
@@ -67,19 +68,12 @@ private:
jmethodID mWeakRefGet; // cache WeakReference::Get method id
};
-class JavaInstance
+class JavaInstance : public RefCounted<JavaInstance>
{
public:
JavaInstance(jobject instance);
~JavaInstance();
- void ref() { _refCount++; }
- void deref()
- {
- if (--_refCount == 0)
- delete this;
- }
-
JavaClass* getClass() const;
bool invokeMethod(const char* name, const NPVariant* args, uint32_t argsCount, NPVariant* result);
@@ -92,7 +86,6 @@ public:
private:
RefPtr<JObjectWrapper> _instance;
- unsigned int _refCount;
mutable JavaClass* _class;
};