From eb10d3e1d6da7f2e97d7d705f89b8e43970cabd3 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Thu, 12 Dec 2019 12:46:33 -0800 Subject: [PATCH] Fabric: Removing REACT_FABRIC_SYNC_EVENT_DISPATCHING_DISABLED macro Summary: When we designed the Fabric's event priorities we followed the model "let's assign all priorities to all events as they should theoretically be and create a flag that disables sync execution (because we were unsure that it's stable enough". After some experiments, it's clear that this model is not feasible. We realized that we were often not sure about the exact event priority that should be assigned to a particular event. We also realized that the priorities in web work differently compare to RN. And we are not sure how we should ensure ordering among events in different queues with different priorities. At the same time, we want to use (or experiment with) sync events for in some cases when we sure about desired behavior and/or where async events make no sense. This diff deletes the macro that disables sync priorities and explicitly assigns async priorities to events that previously had sync ones. The actual behavior should not change. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D18950431 fbshipit-source-id: 4033ef63d4e736075b525a693cd514d7b92d5bb0 --- ReactCommon/fabric/components/view/TouchEventEmitter.cpp | 8 ++++---- ReactCommon/fabric/core/events/EventDispatcher.cpp | 6 ------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ReactCommon/fabric/components/view/TouchEventEmitter.cpp b/ReactCommon/fabric/components/view/TouchEventEmitter.cpp index c18a6282238..4b582c6ba47 100644 --- a/ReactCommon/fabric/components/view/TouchEventEmitter.cpp +++ b/ReactCommon/fabric/components/view/TouchEventEmitter.cpp @@ -64,19 +64,19 @@ void TouchEventEmitter::dispatchTouchEvent( } void TouchEventEmitter::onTouchStart(TouchEvent const &event) const { - dispatchTouchEvent("touchStart", event, EventPriority::SynchronousUnbatched); + dispatchTouchEvent("touchStart", event, EventPriority::AsynchronousBatched); } void TouchEventEmitter::onTouchMove(TouchEvent const &event) const { - dispatchTouchEvent("touchMove", event, EventPriority::SynchronousBatched); + dispatchTouchEvent("touchMove", event, EventPriority::AsynchronousBatched); } void TouchEventEmitter::onTouchEnd(TouchEvent const &event) const { - dispatchTouchEvent("touchEnd", event, EventPriority::SynchronousBatched); + dispatchTouchEvent("touchEnd", event, EventPriority::AsynchronousBatched); } void TouchEventEmitter::onTouchCancel(TouchEvent const &event) const { - dispatchTouchEvent("touchCancel", event, EventPriority::SynchronousBatched); + dispatchTouchEvent("touchCancel", event, EventPriority::AsynchronousBatched); } } // namespace react diff --git a/ReactCommon/fabric/core/events/EventDispatcher.cpp b/ReactCommon/fabric/core/events/EventDispatcher.cpp index 793c003d328..dd08e2330ca 100644 --- a/ReactCommon/fabric/core/events/EventDispatcher.cpp +++ b/ReactCommon/fabric/core/events/EventDispatcher.cpp @@ -13,8 +13,6 @@ #include "RawEvent.h" #include "UnbatchedEventQueue.h" -#define REACT_FABRIC_SYNC_EVENT_DISPATCHING_DISABLED - namespace facebook { namespace react { @@ -58,10 +56,6 @@ void EventDispatcher::dispatchStateUpdate( } const EventQueue &EventDispatcher::getEventQueue(EventPriority priority) const { -#ifdef REACT_FABRIC_SYNC_EVENT_DISPATCHING_DISABLED - priority = EventPriority::AsynchronousBatched; -#endif - return *eventQueues_[(int)priority]; }