Skip to content

Commit 30910d7

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Refactor 'induce' of events in Fabric Android
Summary: This diff refactors the exeuction of 'AsyncEventBeat.induce()' as part of the delivery of events of Fabric Android implementation. The first part of the refactor moves the exeuction of onBatchEventDispatched out of the synchronization block for mEventsToDispatchLock. This lock is accessed from the UI Thread and executing the induce inside this synchronization block will affect UI, The second part of the refactor is to ensure that the exeuction of the C++ method AsyncEventBeat.induce() always happen in the JS Thread. Reviewed By: shergin Differential Revision: D12861387 fbshipit-source-id: e1cd03467274a1c5fcd04b0ac7efdbe7169b14c3
1 parent 08319f1 commit 30910d7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,12 @@ public void run() {
365365
event.dispatch(mReactEventEmitter);
366366
event.dispose();
367367
}
368-
for (BatchEventDispatchedListener listener : mPostEventDispatchListeners) {
369-
listener.onBatchEventDispatched();
370-
}
371368
clearEventsToDispatch();
372369
mEventCookieToLastEventIdx.clear();
373370
}
371+
for (BatchEventDispatchedListener listener : mPostEventDispatchListeners) {
372+
listener.onBatchEventDispatched();
373+
}
374374
} finally {
375375
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
376376
}

0 commit comments

Comments
 (0)