Pass eventPriority by value instead of reference

Summary:
Changelog: [internal]

EventPriority is backed by int, passing it by reference doesn't provide any performance benefits. Quite contrary, it can make it slower because of indirectness (in our case it is probably negligible).

Reviewed By: mdvacca

Differential Revision: D27938600

fbshipit-source-id: 37d1312627dd5a8f9012dfb35d21afe716a16ad7
This commit is contained in:
Samuel Susla
2021-04-24 03:21:08 -07:00
committed by Facebook GitHub Bot
parent f31497354b
commit 09cb12c26c
3 changed files with 5 additions and 5 deletions
@@ -52,7 +52,7 @@ EventEmitter::EventEmitter(
void EventEmitter::dispatchEvent(
const std::string &type,
const folly::dynamic &payload,
const EventPriority &priority) const {
EventPriority priority) const {
dispatchEvent(
type,
[payload](jsi::Runtime &runtime) {
@@ -64,7 +64,7 @@ void EventEmitter::dispatchEvent(
void EventEmitter::dispatchEvent(
const std::string &type,
const ValueFactory &payloadFactory,
const EventPriority &priority) const {
EventPriority priority) const {
SystraceSection s("EventEmitter::dispatchEvent");
auto eventDispatcher = eventDispatcher_.lock();
@@ -71,12 +71,12 @@ class EventEmitter {
const std::string &type,
const ValueFactory &payloadFactory =
EventEmitter::defaultPayloadFactory(),
const EventPriority &priority = EventPriority::AsynchronousBatched) const;
EventPriority priority = EventPriority::AsynchronousBatched) const;
void dispatchEvent(
const std::string &type,
const folly::dynamic &payload,
const EventPriority &priority = EventPriority::AsynchronousBatched) const;
EventPriority priority = EventPriority::AsynchronousBatched) const;
void dispatchUniqueEvent(
const std::string &type,
@@ -10,7 +10,7 @@
namespace facebook {
namespace react {
enum class EventPriority : int {
enum class EventPriority {
SynchronousUnbatched,
SynchronousBatched,
AsynchronousUnbatched,