1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include "jni.h" 18#include <nativehelper/JNIHelp.h> 19#include "core_jni_helpers.h" 20 21namespace android { 22 23static void incStrong(JNIEnv* env, jobject clazz, jlong objPtr) { 24 VirtualLightRefBase* obj = reinterpret_cast<VirtualLightRefBase*>(objPtr); 25 obj->incStrong(0); 26} 27 28static void decStrong(JNIEnv* env, jobject clazz, jlong objPtr) { 29 VirtualLightRefBase* obj = reinterpret_cast<VirtualLightRefBase*>(objPtr); 30 obj->decStrong(0); 31} 32 33// ---------------------------------------------------------------------------- 34// JNI Glue 35// ---------------------------------------------------------------------------- 36 37const char* const kClassPathName = "com/android/internal/util/VirtualRefBasePtr"; 38 39static const JNINativeMethod gMethods[] = { 40 { "nIncStrong", "(J)V", (void*) incStrong }, 41 { "nDecStrong", "(J)V", (void*) decStrong }, 42}; 43 44int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv* env) { 45 return RegisterMethodsOrDie(env, kClassPathName, gMethods, NELEM(gMethods)); 46} 47 48 49} // namespace android 50