bind: split out Seq.getRef calls with Go references

Today, the Seq.Ref class has two purposes. For Java references,
Ref contains the refnum, a reference to the Java object and a
reference count. For Go references, Ref contains the refnum and
its finalizer makes sure to decrement the reference count on the Go
side.

The next CL will replace the use of finalizers with an explicit
ReferenceQueue of Go references, and the Ref class will no longer
be used for Go refences. To prepare for that, this CL pulls up the
construction of Go referencing Ref instances into the Seq.trackGoRef
function.

Change-Id: I9eefe238cd3fd1b661b2af11d331a2f61e31303b
Reviewed-on: https://go-review.googlesource.com/106875
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
Elias Naur
2018-04-17 14:58:00 +00:00
parent 1f177cbe4d
commit 5b452fe89a
29 changed files with 181 additions and 192 deletions
+5 -5
View File
@@ -92,7 +92,7 @@ public abstract class Java {
return refnum;
}
proxyF(Seq.Ref ref) { this.ref = ref; }
proxyF(int refnum) { this.ref = Seq.trackGoRef(refnum); }
public native String toString();
}
@@ -105,7 +105,7 @@ public abstract class Java {
return refnum;
}
proxyL(Seq.Ref ref) { this.ref = ref; }
proxyL(int refnum) { this.ref = Seq.trackGoRef(refnum); }
public native String toString();
}
@@ -118,7 +118,7 @@ public abstract class Java {
return refnum;
}
proxyO(Seq.Ref ref) { this.ref = ref; }
proxyO(int refnum) { this.ref = Seq.trackGoRef(refnum); }
public native String toString();
}
@@ -131,7 +131,7 @@ public abstract class Java {
return refnum;
}
proxyR(Seq.Ref ref) { this.ref = ref; }
proxyR(int refnum) { this.ref = Seq.trackGoRef(refnum); }
}
private static final class proxyS implements Seq.Proxy, S {
@@ -143,7 +143,7 @@ public abstract class Java {
return refnum;
}
proxyS(Seq.Ref ref) { this.ref = ref; }
proxyS(int refnum) { this.ref = Seq.trackGoRef(refnum); }
public native String toString();
}