MCPcopy Index your code
hub / github.com/golang/mobile / dec

Method dec

bind/java/Seq.java:212–232  ·  view source on GitHub ↗
(int refnum)

Source from the content-addressed store, hash-verified

210 // If the count reaches zero, the Java object is removed
211 // from the javaObjs map.
212 synchronized void dec(int refnum) {
213 if (refnum <= 0) {
214 // We don't keep track of the Go object.
215 // This must not happen.
216 log.severe("dec request for Go object "+ refnum);
217 return;
218 }
219 if (refnum == Seq.nullRef.refnum) {
220 return;
221 }
222 // Java objects are removed on request of Go.
223 Ref obj = javaObjs.get(refnum);
224 if (obj == null) {
225 throw new RuntimeException("referenced Java object is not found: refnum="+refnum);
226 }
227 obj.refcnt--;
228 if (obj.refcnt <= 0) {
229 javaObjs.remove(refnum);
230 javaRefs.remove(obj.obj);
231 }
232 }
233
234 // get returns an existing Ref to a Java object.
235 synchronized Ref get(int refnum) {

Callers 1

decRefMethod · 0.80

Calls 2

removeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected