mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Avoid string copy in event dispatching
Summary: Changelog: [internal] To avoid unnecessary string copy in event pipeline, use move semantics. Event pipeline has ownership of event type. Passing it by reference ends up in a copy when `RawEvent` object is constructed. To avoid this, pass string by value through each layer and use move semantics to avoid extra copies. Reviewed By: javache Differential Revision: D34392608 fbshipit-source-id: c11d221be345665e165d9edbc360ba5a057e3890
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8200063ac6
commit
e97e3499c3
@@ -19,7 +19,7 @@ EventEmitterWrapper::initHybrid(jni::alias_ref<jclass>) {
|
||||
}
|
||||
|
||||
void EventEmitterWrapper::invokeEvent(
|
||||
std::string const &eventName,
|
||||
std::string eventName,
|
||||
NativeMap *payload,
|
||||
int category) {
|
||||
// It is marginal, but possible for this to be constructed without a valid
|
||||
@@ -35,7 +35,7 @@ void EventEmitterWrapper::invokeEvent(
|
||||
}
|
||||
|
||||
void EventEmitterWrapper::invokeUniqueEvent(
|
||||
std::string const &eventName,
|
||||
std::string eventName,
|
||||
NativeMap *payload,
|
||||
int customCoalesceKey) {
|
||||
// TODO: customCoalesceKey currently unused
|
||||
|
||||
@@ -25,10 +25,9 @@ class EventEmitterWrapper : public jni::HybridClass<EventEmitterWrapper> {
|
||||
|
||||
SharedEventEmitter eventEmitter;
|
||||
|
||||
void
|
||||
invokeEvent(std::string const &eventName, NativeMap *params, int category);
|
||||
void invokeEvent(std::string eventName, NativeMap *params, int category);
|
||||
void invokeUniqueEvent(
|
||||
std::string const &eventName,
|
||||
std::string eventName,
|
||||
NativeMap *params,
|
||||
int customCoalesceKey);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user