Clean up unbatched only experiment

Summary:
changelog: [internal]

The experiment isn't shipping.

Reviewed By: JoshuaGross

Differential Revision: D30303379

fbshipit-source-id: 80b89d3738c1640f6abefcad161f95397c88ee04
This commit is contained in:
Samuel Susla
2021-08-16 04:35:02 -07:00
committed by Facebook GitHub Bot
parent c0ce346203
commit 5b5ece7980
3 changed files with 14 additions and 45 deletions
@@ -20,8 +20,7 @@ EventDispatcher::EventDispatcher(
EventQueueProcessor eventProcessor,
EventBeat::Factory const &synchonousEventBeatFactory,
EventBeat::Factory const &asynchonousEventBeatFactory,
EventBeat::SharedOwnerBox const &ownerBox,
bool unbatchedQueuesOnly)
EventBeat::SharedOwnerBox const &ownerBox)
: synchronousUnbatchedQueue_(std::make_unique<UnbatchedEventQueue>(
eventProcessor,
synchonousEventBeatFactory(ownerBox))),
@@ -33,8 +32,7 @@ EventDispatcher::EventDispatcher(
asynchonousEventBeatFactory(ownerBox))),
asynchronousBatchedQueue_(std::make_unique<BatchedEventQueue>(
eventProcessor,
asynchonousEventBeatFactory(ownerBox))),
unbatchedQueuesOnly_(unbatchedQueuesOnly) {}
asynchonousEventBeatFactory(ownerBox))) {}
void EventDispatcher::dispatchEvent(RawEvent &&rawEvent, EventPriority priority)
const {
@@ -48,36 +46,19 @@ void EventDispatcher::dispatchStateUpdate(
}
void EventDispatcher::dispatchUniqueEvent(RawEvent &&rawEvent) const {
if (unbatchedQueuesOnly_) {
asynchronousUnbatchedQueue_->enqueueUniqueEvent(std::move(rawEvent));
} else {
asynchronousBatchedQueue_->enqueueUniqueEvent(std::move(rawEvent));
}
asynchronousBatchedQueue_->enqueueUniqueEvent(std::move(rawEvent));
}
const EventQueue &EventDispatcher::getEventQueue(EventPriority priority) const {
if (unbatchedQueuesOnly_) {
switch (priority) {
case EventPriority::SynchronousUnbatched:
return *synchronousUnbatchedQueue_;
case EventPriority::SynchronousBatched:
return *synchronousUnbatchedQueue_;
case EventPriority::AsynchronousUnbatched:
return *asynchronousUnbatchedQueue_;
case EventPriority::AsynchronousBatched:
return *asynchronousUnbatchedQueue_;
}
} else {
switch (priority) {
case EventPriority::SynchronousUnbatched:
return *synchronousUnbatchedQueue_;
case EventPriority::SynchronousBatched:
return *synchronousBatchedQueue_;
case EventPriority::AsynchronousUnbatched:
return *asynchronousUnbatchedQueue_;
case EventPriority::AsynchronousBatched:
return *asynchronousBatchedQueue_;
}
switch (priority) {
case EventPriority::SynchronousUnbatched:
return *synchronousUnbatchedQueue_;
case EventPriority::SynchronousBatched:
return *synchronousBatchedQueue_;
case EventPriority::AsynchronousUnbatched:
return *asynchronousUnbatchedQueue_;
case EventPriority::AsynchronousBatched:
return *asynchronousBatchedQueue_;
}
}
@@ -32,8 +32,7 @@ class EventDispatcher {
EventQueueProcessor eventProcessor,
EventBeat::Factory const &synchonousEventBeatFactory,
EventBeat::Factory const &asynchonousEventBeatFactory,
EventBeat::SharedOwnerBox const &ownerBox,
bool unbatchedQueuesOnly);
EventBeat::SharedOwnerBox const &ownerBox);
/*
* Dispatches a raw event with given priority using event-delivery pipe.
@@ -60,8 +59,6 @@ class EventDispatcher {
std::unique_ptr<BatchedEventQueue> synchronousBatchedQueue_;
std::unique_ptr<UnbatchedEventQueue> asynchronousUnbatchedQueue_;
std::unique_ptr<BatchedEventQueue> asynchronousBatchedQueue_;
bool const unbatchedQueuesOnly_;
};
} // namespace react
@@ -69,22 +69,13 @@ Scheduler::Scheduler(
uiManager->updateState(stateUpdate);
};
#ifdef ANDROID
auto unbatchedQueuesOnly =
reactNativeConfig_->getBool("react_fabric:unbatched_queues_only_android");
#else
auto unbatchedQueuesOnly =
reactNativeConfig_->getBool("react_fabric:unbatched_queues_only_ios");
#endif
// Creating an `EventDispatcher` instance inside the already allocated
// container (inside the optional).
eventDispatcher_->emplace(
EventQueueProcessor(eventPipe, statePipe),
schedulerToolbox.synchronousEventBeatFactory,
schedulerToolbox.asynchronousEventBeatFactory,
eventOwnerBox,
unbatchedQueuesOnly);
eventOwnerBox);
// Casting to `std::shared_ptr<EventDispatcher const>`.
auto eventDispatcher =