Skip to content

Commit dfcb56d

Browse files
mdvaccameta-codesync[bot]
authored andcommitted
Add KDoc documentation to GuardedFrameCallback (#55022)
Summary: Pull Request resolved: #55022 Added comprehensive KDoc comments to GuardedFrameCallback.kt to document all public constructors and the doFrame method. The documentation explains the exception handling behavior, constructor parameters, and frame callback implementation. changelog: [Android][Changed] Updated documentation for GuardedFrameCallback class Reviewed By: cortinico Differential Revision: D90043453 fbshipit-source-id: 124965af92b8435feca055e59c6a2cb81064e90a
1 parent 90e48d6 commit dfcb56d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,29 @@ import com.facebook.react.bridge.ReactContext
1414
/**
1515
* Abstract base for a Choreographer FrameCallback that should have any RuntimeExceptions it throws
1616
* handled by the [JSExceptionHandler] registered if the app is in dev mode.
17+
*
18+
* @property exceptionHandler The handler for RuntimeExceptions thrown during frame callbacks.
19+
* @constructor Creates a GuardedFrameCallback with the specified exception handler.
1720
*/
1821
public abstract class GuardedFrameCallback
1922
protected constructor(private val exceptionHandler: JSExceptionHandler) :
2023
Choreographer.FrameCallback {
24+
/**
25+
* Creates a GuardedFrameCallback using the exception handler from the provided ReactContext.
26+
*
27+
* @param reactContext The React context whose exception handler will be used.
28+
*/
2129
protected constructor(reactContext: ReactContext) : this(reactContext.exceptionHandler)
2230

31+
/**
32+
* Choreographer frame callback implementation that guards [doFrameGuarded] with exception
33+
* handling.
34+
*
35+
* Wraps calls to [doFrameGuarded] in a try-catch block. Any RuntimeExceptions thrown are caught
36+
* and passed to the exception handler instead of crashing the app.
37+
*
38+
* @param frameTimeNanos The time in nanoseconds when the frame started being rendered.
39+
*/
2340
public override fun doFrame(frameTimeNanos: Long) {
2441
try {
2542
doFrameGuarded(frameTimeNanos)

0 commit comments

Comments
 (0)