Skip to content

Commit

Permalink
Pass StateHandler to LayoutState.calculate
Browse files Browse the repository at this point in the history
Reviewed By: adityasharat

Differential Revision: D30934733

fbshipit-source-id: e354ab1cee4a7a5817a4763f919632f2702aba23
  • Loading branch information
SidharthGuglani-zz authored and facebook-github-bot committed Sep 15, 2021
1 parent d9bc018 commit cd4a4a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2949,9 +2949,9 @@ private LayoutState calculateLayoutStateInternal() {
final ComponentContext contextWithStateHandler;
final LayoutState previousLayoutState;

final StateHandler stateHandler;
synchronized (ComponentTree.this) {
final StateHandler stateHandler =
StateHandler.createNewInstance(ComponentTree.this.mStateHandler);
stateHandler = StateHandler.createNewInstance(ComponentTree.this.mStateHandler);

previousLayoutState = mCommittedLayoutState;
contextWithStateHandler = new ComponentContext(context, stateHandler, treeProps, null);
Expand All @@ -2962,6 +2962,7 @@ private LayoutState calculateLayoutStateInternal() {
contextWithStateHandler,
root,
layoutStateFuture,
stateHandler,
ComponentTree.this.mId,
widthSpec,
heightSpec,
Expand Down
3 changes: 2 additions & 1 deletion litho-core/src/main/java/com/facebook/litho/LayoutState.java
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,7 @@ static LayoutState calculate(
c,
component,
null,
new StateHandler(),
componentTreeId,
widthSpec,
heightSpec,
Expand All @@ -1531,6 +1532,7 @@ static LayoutState calculate(
ComponentContext c,
Component component,
@Nullable LayoutStateFuture layoutStateFuture,
StateHandler stateHandler,
int componentTreeId,
int widthSpec,
int heightSpec,
Expand All @@ -1539,7 +1541,6 @@ static LayoutState calculate(
@Nullable LayoutState currentLayoutState,
@CalculateLayoutSource int source,
@Nullable String extraAttribution) {
final StateHandler stateHandler = c.getStateHandler();

final ComponentsLogger logger = c.getLogger();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ private static LayoutState calculateLayoutState(
context,
component,
null,
new StateHandler(),
componentTreeId,
widthSpec,
heightSpec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ private static LayoutState calculateLayoutState(
context,
component,
null,
new StateHandler(),
-1,
widthSpec,
heightSpec,
Expand All @@ -791,6 +792,7 @@ private static LayoutState calculateLayoutStateWithDiffing(
context,
component,
null,
new StateHandler(),
-1,
widthSpec,
heightSpec,
Expand Down

0 comments on commit cd4a4a8

Please sign in to comment.