Skip to content

Commit

Permalink
Small cleanups
Browse files Browse the repository at this point in the history
Summary:
As per title, in this diff:
1. LifecycleAware PoolScope no longer holds onto the lifecycle instance.
2. RecyclerBinder.Builder.poolScope method is annotated with ExperimentalLithoApi annotation.
3. ComponentTree only sets implicit tree prop if appropriate ComponentsConfiguration flags are enabled.

Reviewed By: fbcbl, luluwu2032

Differential Revision: D64689427

fbshipit-source-id: 12ad1d389582380555fbc90d70e0bed6c97e0e10
  • Loading branch information
zielinskimz authored and facebook-github-bot committed Oct 22, 2024
1 parent 538df6b commit bf59337
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,9 @@ protected ComponentTree(Builder builder) {
if (ComponentsConfiguration.defaultInstance.enableLifecycleOwnerWrapper) {
LifecycleOwner implicitLifecycleOwner = getImplicitLifecycleOwner(builder.treePropContainer);
mImplicitTreePropContainer = createImplicitTreePropContainer(implicitLifecycleOwner);
}

@Nullable final PoolScope poolScope = builder.mPoolScope;
if (poolScope != null) {
mImplicitTreePropContainer.put(PoolScopeTreeProp, poolScope);
if (ComponentsConfiguration.customPoolScopesEnabled) {
mImplicitTreePropContainer.put(PoolScopeTreeProp, builder.mPoolScope);
}
}

if (useComponentTreePropContainerAsSourceOfTruth) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ sealed interface PoolScope {
* A pool scope that automatically releases the pool when the given [lifecycle] transitions to
* destroyed state
*/
class LifecycleAware(private val lifecycle: Lifecycle) : PoolScope {
class LifecycleAware(lifecycle: Lifecycle) : PoolScope {
init {
lifecycle.addObserver(
object : DefaultLifecycleObserver {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import com.facebook.litho.Size;
import com.facebook.litho.SizeSpec;
import com.facebook.litho.ThreadUtils;
import com.facebook.litho.annotations.ExperimentalLithoApi;
import com.facebook.litho.choreographercompat.ChoreographerCompat;
import com.facebook.litho.choreographercompat.ChoreographerCompatImpl;
import com.facebook.litho.config.ComponentsConfiguration;
Expand Down Expand Up @@ -602,6 +603,7 @@ public Builder errorHandler(@Nullable Function1<Exception, Unit> handler) {
return this;
}

@ExperimentalLithoApi
public Builder poolScope(PoolScope poolScope) {
this.poolScope = poolScope;
return this;
Expand Down

0 comments on commit bf59337

Please sign in to comment.