More generous access to DestructorThread.Destructor

Summary:
In order to extend / use  `DestructorThread.Destructor` outside of `com.facebook.jni`, we need access modifiers to be less strict:

- `Destructor#Destructor()`: package protected -> public
- `Destructor#destruct()`: package protected -> protected

This will enable Yoga to move from finalizers to `DestructorThread.Destructor` without having to buy into `HybridData` completely.

Reviewed By: cjhopman

Differential Revision: D16182362

fbshipit-source-id: ad616c403df8e7c1e3d751131cfb7a9cfe62cf24
This commit is contained in:
David Aurelio
2019-07-12 02:01:29 -07:00
committed by Facebook Github Bot
parent 6c362a7b19
commit 9374b23b33
2 changed files with 4 additions and 4 deletions
@@ -31,7 +31,7 @@ public class DestructorThread {
private Destructor next;
private Destructor previous;
Destructor(Object referent) {
public Destructor(Object referent) {
super(referent, sReferenceQueue);
sDestructorStack.push(this);
}
@@ -41,7 +41,7 @@ public class DestructorThread {
}
/** Callback which is invoked when the original object has been garbage collected. */
abstract void destruct();
protected abstract void destruct();
}
/** A list to keep all active Destructors in memory confined to the Destructor thread. */
@@ -84,7 +84,7 @@ public class DestructorThread {
private static class Terminus extends Destructor {
@Override
void destruct() {
protected void destruct() {
throw new IllegalStateException("Cannot destroy Terminus Destructor.");
}
}
@@ -63,7 +63,7 @@ public class HybridData {
}
@Override
void destruct() {
protected final void destruct() {
// When invoked from the DestructorThread instead of resetNative,
// the DestructorThread has exclusive ownership of the HybridData
// so synchronization is not necessary.