Skip to content

Commit

Permalink
More generous access to DestructorThread.Destructor
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davidaurelio authored and facebook-github-bot committed Jul 12, 2019
1 parent 6c362a7 commit 9374b23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public abstract static class Destructor extends PhantomReference<Object> {
private Destructor next;
private Destructor previous;

Destructor(Object referent) {
public Destructor(Object referent) {
super(referent, sReferenceQueue);
sDestructorStack.push(this);
}
Expand All @@ -41,7 +41,7 @@ private Destructor() {
}

/** 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. */
Expand Down Expand Up @@ -84,7 +84,7 @@ public void run() {

private static class Terminus extends Destructor {
@Override
void destruct() {
protected void destruct() {
throw new IllegalStateException("Cannot destroy Terminus Destructor.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static class Destructor extends DestructorThread.Destructor {
}

@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.
Expand Down

0 comments on commit 9374b23

Please sign in to comment.