Skip to content

Commit

Permalink
Use reference for command args
Browse files Browse the repository at this point in the history
Summary:
The IDE warning suggests that passing folly::dynamic by value will create a copy on each call.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D32978154

fbshipit-source-id: a47a60c332a9d299eb2110d3537dfab0bc2398b6
  • Loading branch information
Andrei Shikov authored and facebook-github-bot committed Dec 9, 2021
1 parent 891a1c1 commit 1d4e7f6
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion React/Fabric/RCTScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN

- (void)schedulerDidDispatchCommand:(facebook::react::ShadowView const &)shadowView
commandName:(std::string const &)commandName
args:(folly::dynamic const)args;
args:(folly::dynamic const &)args;

- (void)schedulerDidSendAccessibilityEvent:(facebook::react::ShadowView const &)shadowView
eventType:(std::string const &)eventType;
Expand Down
2 changes: 1 addition & 1 deletion React/Fabric/RCTScheduler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void schedulerDidCloneShadowNode(
void schedulerDidDispatchCommand(
const ShadowView &shadowView,
const std::string &commandName,
const folly::dynamic args) override
const folly::dynamic &args) override
{
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
[scheduler.delegate schedulerDidDispatchCommand:shadowView commandName:commandName args:args];
Expand Down
2 changes: 1 addition & 1 deletion React/Fabric/RCTSurfacePresenter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ - (void)schedulerDidFinishTransaction:(MountingCoordinator::Shared const &)mount

- (void)schedulerDidDispatchCommand:(ShadowView const &)shadowView
commandName:(std::string const &)commandName
args:(folly::dynamic const)args
args:(folly::dynamic const &)args
{
ReactTag tag = shadowView.tag;
NSString *commandStr = [[NSString alloc] initWithUTF8String:commandName.c_str()];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ void Binding::schedulerDidCloneShadowNode(
void Binding::schedulerDidDispatchCommand(
const ShadowView &shadowView,
std::string const &commandName,
folly::dynamic const args) {
folly::dynamic const &args) {
jni::global_ref<jobject> localJavaUIManager = getJavaUIManager();
if (!localJavaUIManager) {
LOG(ERROR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class Binding : public jni::HybridClass<Binding>,
void schedulerDidDispatchCommand(
const ShadowView &shadowView,
std::string const &commandName,
folly::dynamic const args) override;
folly::dynamic const &args) override;

void schedulerDidSendAccessibilityEvent(
const ShadowView &shadowView,
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void Scheduler::uiManagerDidCloneShadowNode(
void Scheduler::uiManagerDidDispatchCommand(
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) {
folly::dynamic const &args) {
SystraceSection s("Scheduler::uiManagerDispatchCommand");

if (delegate_) {
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/scheduler/Scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Scheduler final : public UIManagerDelegate {
void uiManagerDidDispatchCommand(
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) override;
folly::dynamic const &args) override;
void uiManagerDidSendAccessibilityEvent(
const ShadowNode::Shared &shadowNode,
std::string const &eventType) override;
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/scheduler/SchedulerDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SchedulerDelegate {
virtual void schedulerDidDispatchCommand(
const ShadowView &shadowView,
std::string const &commandName,
folly::dynamic const args) = 0;
folly::dynamic const &args) = 0;

virtual void schedulerDidSendAccessibilityEvent(
const ShadowView &shadowView,
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/uimanager/UIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void UIManager::updateState(StateUpdate const &stateUpdate) const {
void UIManager::dispatchCommand(
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) const {
folly::dynamic const &args) const {
if (delegate_) {
delegate_->uiManagerDidDispatchCommand(shadowNode, commandName, args);
}
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/uimanager/UIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class UIManager final : public ShadowTreeDelegate {
void dispatchCommand(
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) const;
folly::dynamic const &args) const;

void sendAccessibilityEvent(
const ShadowNode::Shared &shadowNode,
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/uimanager/UIManagerDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class UIManagerDelegate {
virtual void uiManagerDidDispatchCommand(
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) = 0;
folly::dynamic const &args) = 0;

/*
* Called when UIManager wants to dispatch some accessibility event
Expand Down

0 comments on commit 1d4e7f6

Please sign in to comment.