mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook Github Bot
parent
6c362a7b19
commit
9374b23b33
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user