blob: d20bae232656fb1b784d919672b8b660c20371c9 [file] [log] [blame]
John Reck9fa40712014-05-09 15:26:59 -07001/*
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>
Andreas Gampeed6b9df2014-11-20 22:02:20 -080019#include "core_jni_helpers.h"
John Reck9fa40712014-05-09 15:26:59 -070020
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
Daniel Micay76f6a862015-09-19 17:31:01 -040039static const JNINativeMethod gMethods[] = {
John Reck9fa40712014-05-09 15:26:59 -070040 { "nIncStrong", "(J)V", (void*) incStrong },
41 { "nDecStrong", "(J)V", (void*) decStrong },
42};
43
44int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv* env) {
Andreas Gampeed6b9df2014-11-20 22:02:20 -080045 return RegisterMethodsOrDie(env, kClassPathName, gMethods, NELEM(gMethods));
John Reck9fa40712014-05-09 15:26:59 -070046}
47
48
49} // namespace android