2
0
mirror of synced 2025-02-23 06:48:15 +00:00

20 Commits

Author SHA1 Message Date
Hyang-Ah (Hana) Kim
71e2276663 bind/java: pin java byte array elements until Seq send is done.
When passing a byte array from Java to Go, Seq.writeByteArray JNI
call encodes only the array size and the pointer to the array.
Go-side receives the (size, ptr) pair info during the subsequent
Seq.send JNI call, and copies the elements into a Go byte slice.
We must pin the array elements until Go-side completes copying
so that they are not moved or collected by Java runtime.

This change keeps track of the pinned array info in a 'pinned' linked
list, and unpin them as the Seq memory is freed.  The jbyteArray
argument passed to Seq.writeByteArray is needed to release the pinned
byte array elements, but that is a "local reference". It is not
guaranteed that the reference is valid after the method returns. Thus,
we stash its global reference in the 'pinned' list and delete it later
as well.

A similar problem can occur on the byte slice returned from a Go function.
This change does not address the case yet.

Fixes golang/go#9486

Change-Id: I1255aefbc80b21ccbe9b2bf37699faaf0c5f0bae
Reviewed-on: https://go-review.googlesource.com/2586
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-14 19:06:28 +00:00
Hyang-Ah Hana Kim
2b3c96656c cmd/gobind: implement interface method binding.
This change makes gobind to generate proper Go-side proxy code to
handle interface methods that have parameters and return values.

It allows gobind to accept struct pointer types as parameters
or a return value of a method.

Fixes golang/go#9487, golang/go#9488.

Change-Id: Id243c42ee0701d40e3871e392140368c2f8f9bc6
Reviewed-on: https://go-review.googlesource.com/2348
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-07 18:26:42 +00:00
Hyang-Ah Hana Kim
8f449fffd2 bind/java/testpkg: use go generate to run gobind on testpkg.
Change-Id: I2426f3607120b7ce2da60bcb45d834b539d7dbb9
Reviewed-on: https://go-review.googlesource.com/2342
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-07 17:28:35 +00:00
Hyang-Ah Hana Kim
b2e453e1cd bind/java: support byte arrays.
Fixes golang/go#9338.

Change-Id: I6e2af67cdf7f923963fa525b944613a91aac994e
Reviewed-on: https://go-review.googlesource.com/1884
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-19 20:07:11 +00:00
Hana (Hyang-Ah) Kim
8952e43db8 build/androidtest.bash: script to run all tests in a repository on an
android device.

It assumes it runs in golang.org/x/mobile repository.

This script copies the repository source tree into the connected device
and invokes go test that runs using the binary compiled from
go_android_exec.go. go_android_exec arranges to push and run the test
binary to the right place in the android device.

Change-Id: I4ac24bcfd8e26e01cccd3d7c2dddaf6b3c14951e
Reviewed-on: https://go-review.googlesource.com/1680
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-18 00:48:16 +00:00
David Crawshaw
f19599ac73 seq, java: fix allocation bug in empty strings and test
Fixes golang/go#9271.

Change-Id: I57dcd11ae5afdc23bc9b1a0945d0789c9feeefb1
Reviewed-on: https://go-review.googlesource.com/1423
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-12 14:06:53 +00:00
David Crawshaw
6cf9d880ce bind/java: ensure there is enough capacity for writing seq
The new testLongString triggers the bug without this change.

Fixes golang/go#9251.

Change-Id: I463e2897b5b08f53801f151c7311d591546c0719
Reviewed-on: https://go-review.googlesource.com/1373
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-11 17:53:23 +00:00
David Crawshaw
71604ab0e3 bind/java: give mktemp a template for darwin hosts
Change-Id: I4bf795cfe76daae9a922c671722db3e2fa44a0c0
Reviewed-on: https://go-review.googlesource.com/1320
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-10 21:53:24 +00:00
David Symonds
7b659348a5 mobile: add import comments.
Change-Id: I0ff6d42a8e11f49df6fc3066e86be75015b93631
Reviewed-on: https://go-review.googlesource.com/1238
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-10 01:59:04 +00:00
Hana (Hyang-Ah) Kim
969a1bf7dd example/libhellojni: fix build and allow go get golang.org/x/mobile/...
Change-Id: Id0cd58705c882ea58cedbee5a6e9aff010c0ad4d
Reviewed-on: https://go-review.googlesource.com/1281
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-10 01:38:44 +00:00
Hana Kim
404af530f0 mobile/bind/java: update the test.bash to build apk for test.
Requires gradle.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/180480043
2014-12-03 17:39:00 -05:00
David Crawshaw
551dbd1f07 go.mobile/bind/java: support JNI_EDETACHED
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/144780043
2014-12-03 15:24:48 -05:00
Hana Kim
50b4d219bf go.mobile: update bind/java/SeqTest.java to pass.
- Suppressed testJavaRefKeep for now.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/170000045
2014-11-11 09:55:39 -05:00
Hana Kim
32f2370535 go.mobile/bind: include the bind invocation command in generated files.
This change also updates bind/testdata/*.golden.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/167160043
2014-11-10 13:46:47 -05:00
Andrew Gerrand
9470e0ba58 go.mobile: use golang.org/x/... import paths
LGTM=bradfitz, rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/162710043
2014-11-10 08:55:57 +11:00
Hana Kim
d53d8c3f80 go.mobile/bind/java: update javatest.go to build.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/171850043
2014-11-05 13:09:06 -05:00
David Crawshaw
3b555d82f6 go.mobile/bind/java: fix build
I really need to sort out a builder story for end-to-end apps.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/136580043
2014-09-12 10:53:03 -04:00
David Crawshaw
3d312b5a2b go.mobile: break dependency on gobind
Preparation for NativeActivity-based apps.

LGTM=nigeltao
R=golang-codereviews, nigeltao
CC=golang-codereviews
https://golang.org/cl/126520043
2014-09-03 09:03:00 -04:00
David Crawshaw
5487fc8103 go.mobile/bind/java: tests of object reference tracking
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/112700044
2014-07-31 08:25:23 -04:00
David Crawshaw
6a88edec71 go.mobile/bind/java: cgo-JNI bridge using seq
Details: http://golang.org/s/gobind

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/110550044
2014-07-31 08:24:05 -04:00