diff options
author | Jason Sams <rjsams@android.com> | 2009-08-18 17:07:09 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-08-18 17:07:09 -0700 |
commit | 730ee65d4ddb307898053b623120bad1655fadad (patch) | |
tree | ea3d8f41940ef06af43a5fe5436c9c9c3943227d /graphics/jni | |
parent | 7ce033d797e5df5e2131e2ed459fba181eaf4658 (diff) | |
download | frameworks_base-730ee65d4ddb307898053b623120bad1655fadad.zip frameworks_base-730ee65d4ddb307898053b623120bad1655fadad.tar.gz frameworks_base-730ee65d4ddb307898053b623120bad1655fadad.tar.bz2 |
Implement OOB destroy method that can be called from the java finalizer removing the need to explicitly destroy objects.
Diffstat (limited to 'graphics/jni')
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 2d48165..001ecd0 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -86,6 +86,15 @@ nObjDestroy(JNIEnv *_env, jobject _this, jint obj) rsObjDestroy(con, (void *)obj); } +static void +nObjDestroyOOB(JNIEnv *_env, jobject _this, jint obj) +{ + // This function only differs from nObjDestroy in that it calls the + // special Out Of Band version of ObjDestroy which is thread safe. + RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); + LOG_API("nObjDestroyOOB, con(%p) obj(%p)", con, (void *)obj); + rsObjDestroyOOB(con, (void *)obj); +} static jint nFileOpen(JNIEnv *_env, jobject _this, jbyteArray str) @@ -1217,6 +1226,7 @@ static JNINativeMethod methods[] = { {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nAssignName", "(I[B)V", (void*)nAssignName }, {"nObjDestroy", "(I)V", (void*)nObjDestroy }, +{"nObjDestroyOOB", "(I)V", (void*)nObjDestroyOOB }, {"nFileOpen", "([B)I", (void*)nFileOpen }, |