mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fixing getSurfaceHandler() to package in ReactSurface (#39029)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39029 Reducing visibility of `getSurfaceHandler()` in ReactSurface changelog: [internal] internal Reviewed By: luluwu2032 Differential Revision: D48376643 fbshipit-source-id: 6e0873372d96435cc5a3b8baa54b1b592e7327c4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8fa19abd71
commit
aafbe7a458
+13
-12
@@ -99,7 +99,8 @@ public class ReactHostImpl implements ReactHost {
|
||||
private final Executor mBGExecutor;
|
||||
private final Executor mUIExecutor;
|
||||
private final QueueThreadExceptionHandler mQueueThreadExceptionHandler;
|
||||
private final Set<ReactSurface> mAttachedSurfaces = Collections.synchronizedSet(new HashSet<>());
|
||||
private final Set<ReactSurfaceImpl> mAttachedSurfaces =
|
||||
Collections.synchronizedSet(new HashSet<>());
|
||||
private final MemoryPressureRouter mMemoryPressureRouter;
|
||||
private final boolean mAllowPackagerServerAccess;
|
||||
private final boolean mUseDevSupport;
|
||||
@@ -201,7 +202,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
|
||||
/** Initialize and run a React Native surface in a background without mounting real views. */
|
||||
/* package */
|
||||
TaskInterface<Void> prerenderSurface(final ReactSurface surface) {
|
||||
TaskInterface<Void> prerenderSurface(final ReactSurfaceImpl surface) {
|
||||
final String method = "prerenderSurface(surfaceId = " + surface.getSurfaceID() + ")";
|
||||
log(method, "Schedule");
|
||||
|
||||
@@ -221,7 +222,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
* @return A Task that will complete when startSurface has been called.
|
||||
*/
|
||||
/** package */
|
||||
TaskInterface<Void> startSurface(final ReactSurface surface) {
|
||||
TaskInterface<Void> startSurface(final ReactSurfaceImpl surface) {
|
||||
final String method = "startSurface(surfaceId = " + surface.getSurfaceID() + ")";
|
||||
log(method, "Schedule");
|
||||
|
||||
@@ -241,7 +242,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
* @return A Task that will complete when stopSurface has been called.
|
||||
*/
|
||||
/** package */
|
||||
TaskInterface<Void> stopSurface(final ReactSurface surface) {
|
||||
TaskInterface<Void> stopSurface(final ReactSurfaceImpl surface) {
|
||||
final String method = "stopSurface(surfaceId = " + surface.getSurfaceID() + ")";
|
||||
log(method, "Schedule");
|
||||
|
||||
@@ -623,7 +624,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
});
|
||||
}
|
||||
|
||||
/* package */ void attachSurface(ReactSurface surface) {
|
||||
/* package */ void attachSurface(ReactSurfaceImpl surface) {
|
||||
final String method = "attachSurface(surfaceId = " + surface.getSurfaceID() + ")";
|
||||
log(method);
|
||||
|
||||
@@ -632,7 +633,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
}
|
||||
}
|
||||
|
||||
/* package */ void detachSurface(ReactSurface surface) {
|
||||
/* package */ void detachSurface(ReactSurfaceImpl surface) {
|
||||
final String method = "detachSurface(surfaceId = " + surface.getSurfaceID() + ")";
|
||||
log(method);
|
||||
|
||||
@@ -641,7 +642,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
}
|
||||
}
|
||||
|
||||
/* package */ boolean isSurfaceAttached(ReactSurface surface) {
|
||||
/* package */ boolean isSurfaceAttached(ReactSurfaceImpl surface) {
|
||||
synchronized (mAttachedSurfaces) {
|
||||
return mAttachedSurfaces.contains(surface);
|
||||
}
|
||||
@@ -649,7 +650,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
|
||||
/* package */ boolean isSurfaceWithModuleNameAttached(String moduleName) {
|
||||
synchronized (mAttachedSurfaces) {
|
||||
for (ReactSurface surface : mAttachedSurfaces) {
|
||||
for (ReactSurfaceImpl surface : mAttachedSurfaces) {
|
||||
if (surface.getModuleName().equals(moduleName)) {
|
||||
return true;
|
||||
}
|
||||
@@ -1181,7 +1182,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
|
||||
log(method, "Stopping all React Native surfaces");
|
||||
synchronized (mAttachedSurfaces) {
|
||||
for (ReactSurface surface : mAttachedSurfaces) {
|
||||
for (ReactSurfaceImpl surface : mAttachedSurfaces) {
|
||||
if (reactInstance != null) {
|
||||
reactInstance.stopSurface(surface);
|
||||
}
|
||||
@@ -1243,7 +1244,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
log(method, "Restarting previously running React Native Surfaces");
|
||||
|
||||
synchronized (mAttachedSurfaces) {
|
||||
for (ReactSurface surface : mAttachedSurfaces) {
|
||||
for (ReactSurfaceImpl surface : mAttachedSurfaces) {
|
||||
reactInstance.startSurface(surface);
|
||||
}
|
||||
}
|
||||
@@ -1405,7 +1406,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
// Restart any attached surfaces
|
||||
log(method, "Restarting Surfaces");
|
||||
synchronized (mAttachedSurfaces) {
|
||||
for (ReactSurface surface : mAttachedSurfaces) {
|
||||
for (ReactSurfaceImpl surface : mAttachedSurfaces) {
|
||||
reactInstance.startSurface(surface);
|
||||
}
|
||||
}
|
||||
@@ -1476,7 +1477,7 @@ public class ReactHostImpl implements ReactHost {
|
||||
*/
|
||||
log(method, "Stopping surfaces");
|
||||
synchronized (mAttachedSurfaces) {
|
||||
for (ReactSurface surface : mAttachedSurfaces) {
|
||||
for (ReactSurfaceImpl surface : mAttachedSurfaces) {
|
||||
instance.stopSurface(surface);
|
||||
surface.clear();
|
||||
}
|
||||
|
||||
+3
-4
@@ -44,7 +44,6 @@ import com.facebook.react.fabric.FabricUIManager;
|
||||
import com.facebook.react.fabric.ReactNativeConfig;
|
||||
import com.facebook.react.fabric.events.EventBeatManager;
|
||||
import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler;
|
||||
import com.facebook.react.interfaces.fabric.ReactSurface;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.modules.core.JavaTimerManager;
|
||||
import com.facebook.react.modules.core.ReactChoreographer;
|
||||
@@ -361,7 +360,7 @@ final class ReactInstance {
|
||||
}
|
||||
}
|
||||
|
||||
/* package */ void prerenderSurface(ReactSurface surface) {
|
||||
/* package */ void prerenderSurface(ReactSurfaceImpl surface) {
|
||||
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstance.prerenderSurface");
|
||||
FLog.d(TAG, "call prerenderSurface with surface: " + surface.getModuleName());
|
||||
mFabricUIManager.startSurface(surface.getSurfaceHandler(), surface.getContext(), null);
|
||||
@@ -374,7 +373,7 @@ final class ReactInstance {
|
||||
* @param surface The {@link ReactSurface} to render.
|
||||
*/
|
||||
@ThreadConfined("ReactHost")
|
||||
/* package */ void startSurface(ReactSurface surface) {
|
||||
/* package */ void startSurface(ReactSurfaceImpl surface) {
|
||||
FLog.d(TAG, "startSurface() is called with surface: " + surface.getSurfaceID());
|
||||
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstance.startSurface");
|
||||
|
||||
@@ -405,7 +404,7 @@ final class ReactInstance {
|
||||
}
|
||||
|
||||
@ThreadConfined("ReactHost")
|
||||
/* package */ void stopSurface(ReactSurface surface) {
|
||||
/* package */ void stopSurface(ReactSurfaceImpl surface) {
|
||||
FLog.d(TAG, "stopSurface() is called with surface: " + surface.getSurfaceID());
|
||||
mFabricUIManager.stopSurface(surface.getSurfaceHandler());
|
||||
}
|
||||
|
||||
+2
-2
@@ -129,8 +129,8 @@ public class ReactSurfaceImpl implements ReactSurface {
|
||||
mReactHost.set(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceHandler getSurfaceHandler() {
|
||||
/** package */
|
||||
SurfaceHandler getSurfaceHandler() {
|
||||
return mSurfaceHandler;
|
||||
}
|
||||
|
||||
|
||||
-3
@@ -26,9 +26,6 @@ interface ReactSurface {
|
||||
// Returns whether the surface is running or not
|
||||
val isRunning: Boolean
|
||||
|
||||
// Returns surface handler
|
||||
val surfaceHandler: SurfaceHandler
|
||||
|
||||
// Returns React root view of this surface
|
||||
val view: ViewGroup?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user