70
70
import com .facebook .litho .config .ComponentsConfiguration ;
71
71
import com .facebook .litho .config .ResolveCancellationStrategy ;
72
72
import com .facebook .litho .debug .LithoDebugEvent ;
73
+ import com .facebook .litho .debug .LithoDebugEventAttributes ;
73
74
import com .facebook .litho .perfboost .LithoPerfBooster ;
74
75
import com .facebook .litho .stats .LithoStats ;
75
76
import com .facebook .rendercore .RunnableHandler ;
76
77
import com .facebook .rendercore .RunnableHandler .DefaultHandler ;
77
78
import com .facebook .rendercore .debug .DebugEventAttribute ;
79
+ import com .facebook .rendercore .debug .DebugEventBus ;
78
80
import com .facebook .rendercore .debug .DebugEventDispatcher ;
79
81
import com .facebook .rendercore .visibility .VisibilityBoundsTransformer ;
80
82
import java .lang .ref .WeakReference ;
@@ -1432,6 +1434,8 @@ public final void updateHookStateAsync(
1432
1434
}
1433
1435
1434
1436
private void onAsyncStateUpdateEnqueued (String attribution , boolean isCreateLayoutInProgress ) {
1437
+ dispatchStateUpdateEnqueuedEvent (attribution , false );
1438
+
1435
1439
if (mBatchedStateUpdatesStrategy == null
1436
1440
|| !mBatchedStateUpdatesStrategy .onAsyncStateUpdateEnqueued (
1437
1441
attribution , isCreateLayoutInProgress )) {
@@ -1472,6 +1476,8 @@ private void ensureSyncStateUpdateRunnable(String attribution, boolean isCreateL
1472
1476
sSyncStateUpdatesHandler .set (new WeakReference <>(handler ));
1473
1477
}
1474
1478
1479
+ dispatchStateUpdateEnqueuedEvent (attribution , true );
1480
+
1475
1481
synchronized (mUpdateStateSyncRunnableLock ) {
1476
1482
if (mUpdateStateSyncRunnable != null ) {
1477
1483
handler .remove (mUpdateStateSyncRunnable );
@@ -1486,6 +1492,21 @@ private void ensureSyncStateUpdateRunnable(String attribution, boolean isCreateL
1486
1492
}
1487
1493
}
1488
1494
1495
+ private void dispatchStateUpdateEnqueuedEvent (String attribution , boolean isSynchronous ) {
1496
+ if (DebugEventBus .getEnabled ()) {
1497
+ DebugEventDispatcher .dispatch (
1498
+ LithoDebugEvent .StateUpdateEnqueued ,
1499
+ String .valueOf (mId ),
1500
+ () -> {
1501
+ HashMap <String , Object > map = new HashMap <>();
1502
+ map .put (LithoDebugEventAttributes .Root , mRoot != null ? mRoot .getSimpleName () : "" );
1503
+ map .put (LithoDebugEventAttributes .Attribution , attribution );
1504
+ map .put (LithoDebugEventAttributes .StateUpdateType , isSynchronous ? "sync" : "async" );
1505
+ return map ;
1506
+ });
1507
+ }
1508
+ }
1509
+
1489
1510
void updateStateInternal (boolean isAsync , String attribution , boolean isCreateLayoutInProgress ) {
1490
1511
final @ Nullable TreeProps rootTreeProps ;
1491
1512
0 commit comments