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
This commit is contained in:
David Vacca 2018-11-08 16:55:12 -08:00 committed by Facebook Github Bot
parent 7b04f6aeaa
commit 95b21b4828

View File

@ -365,12 +365,12 @@ public class EventDispatcher implements LifecycleEventListener {
event.dispatch(mReactEventEmitter);
event.dispose();
}
for (BatchEventDispatchedListener listener : mPostEventDispatchListeners) {
listener.onBatchEventDispatched();
}
clearEventsToDispatch();
mEventCookieToLastEventIdx.clear();
}
for (BatchEventDispatchedListener listener : mPostEventDispatchListeners) {
listener.onBatchEventDispatched();
}
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}