Skip to content

Commit

Permalink
Renames more methoda and fields [6/n]
Browse files Browse the repository at this point in the history
Summary: [litho][be][event-handler] Renames more methoda and fields

Reviewed By: kingsleyadio

Differential Revision: D63755048

fbshipit-source-id: 4267f62fee201c25fd4926629af58ce152b304a1
  • Loading branch information
adityasharat authored and facebook-github-bot committed Oct 3, 2024
1 parent 07edf11 commit 57f6994
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
18 changes: 3 additions & 15 deletions litho-core/src/main/java/com/facebook/litho/InitialState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class InitialState {
pendingStateHandlers.add(stateHandler)
}

fun createOrGetComponentState(
fun createOrGetState(
component: Component,
scopedContext: ComponentContext,
key: String
Expand All @@ -72,25 +72,13 @@ class InitialState {
return synchronized(stateLock) {
val state =
states.getOrPut(key) {
createInitialStateContainer(context = scopedContext, component = component)
createInitialState(context = scopedContext, component = component)
}
state
}
}

/**
* If an initial state for this component has already been created just transfers it to it.
* Otherwise onCreateInitialState gets called for the component and its result cached.
*/
fun createOrGetInitialStateForComponent(
component: Component,
scopedContext: ComponentContext,
key: String
): StateContainer {
return createOrGetComponentState(component, scopedContext, key).value
}

private fun createInitialStateContainer(
private fun createInitialState(
context: ComponentContext,
component: Component
): ComponentState<out StateContainer> {
Expand Down
4 changes: 2 additions & 2 deletions litho-core/src/main/java/com/facebook/litho/StateHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class StateHandler {
*/
fun getState(key: String): ComponentState<out StateContainer>? = _state[key]

fun createOrGetComponentState(
fun createOrGetState(
scopedContext: ComponentContext,
component: Component,
key: String
Expand All @@ -157,7 +157,7 @@ class StateHandler {
current
} else {
val state =
initialState.createOrGetComponentState(
initialState.createOrGetState(
component,
scopedContext,
key,
Expand Down
4 changes: 2 additions & 2 deletions litho-core/src/main/java/com/facebook/litho/TreeState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class TreeState {
key: String
): ComponentState<out StateContainer> {
return getStateHandler(scopedContext.isNestedTreeContext)
.createOrGetComponentState(scopedContext, component, key)
.createOrGetState(scopedContext, component, key)
}

fun createOrGetEventDispatchInfoForComponent(
Expand All @@ -222,7 +222,7 @@ class TreeState {
): EventDispatchInfo {
return checkNotNull(
getStateHandler(scopedContext.isNestedTreeContext)
.createOrGetComponentState(scopedContext, component, key)
.createOrGetState(scopedContext, component, key)
.eventDispatchInfo)
}

Expand Down

0 comments on commit 57f6994

Please sign in to comment.