-
Notifications
You must be signed in to change notification settings - Fork 6
/
JNIRefs.swift
64 lines (52 loc) · 1.89 KB
/
JNIRefs.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import CJNI
public extension JNI {
public func NewGlobalRef(obj: jobject) -> jobject {
let env = self._env
return env.memory.memory.NewGlobalRef(env, obj)
}
public func DeleteGlobalRef(globalRef: jobject) {
let env = self._env
env.memory.memory.DeleteGlobalRef(env, globalRef)
}
public func NewLocalRef(ref: jobject) -> jobject {
let env = self._env
return env.memory.memory.NewLocalRef(env, ref)
}
public func DeleteLocalRef(localRef: jobject) {
let env = self._env
env.memory.memory.DeleteLocalRef(env, localRef)
}
public func PushLocalFrame(capacity: jint) -> jint {
let env = self._env
return env.memory.memory.PushLocalFrame(env, capacity)
}
public func PopLocalFrame(result: jobject) -> jobject {
let env = self._env
return env.memory.memory.PopLocalFrame(env, result)
}
public func EnsureLocalCapacity(capacity: jint) -> jint {
let env = self._env
return env.memory.memory.EnsureLocalCapacity(env, capacity)
}
public func IsSameObject(ref1: jobject, _ ref2: jobject) -> jboolean {
let env = self._env
return env.memory.memory.IsSameObject(env, ref1, ref2)
}
public func IsInstanceOf(obj: jobject, _ targetClass: jclass) -> jboolean {
let env = self._env
return env.memory.memory.IsInstanceOf(env, obj, targetClass)
}
public func NewWeakGlobalRef(obj: jobject) -> jweak {
let env = self._env
return env.memory.memory.NewWeakGlobalRef(env, obj)
}
public func DeleteWeakGlobalRef(obj: jweak) {
let env = self._env
env.memory.memory.DeleteWeakGlobalRef(env, obj)
}
/* added in 1: JNI.6 */
public func GetObjectRefType(obj: jobject) -> jobjectRefType {
let env = self._env
return env.memory.memory.GetObjectRefType(env, obj)
}
}