Fabric: Using const & in all other appropriate parts of RCTComponentViewProtocol

Summary:
Same as previous one but for the rest (minority) of methods.
I didn't change `updateLocalData:` because it's going away soon anyway.

Reviewed By: mdvacca

Differential Revision: D15473217

fbshipit-source-id: 6a6bd66c5343211a973fc34ad11e86efe031d07d
This commit is contained in:
Valentin Shergin
2019-05-24 12:20:21 -07:00
committed by Facebook Github Bot
parent 0e9c764e28
commit f4a0102642
6 changed files with 22 additions and 17 deletions
@@ -115,7 +115,7 @@ using namespace facebook::react;
// MAP_SCROLL_VIEW_PROP(snapToAlignment);
}
- (void)updateState:(State::Shared)state oldState:(State::Shared)oldState
- (void)updateState:(State::Shared const &)state oldState:(State::Shared const &)oldState
{
assert(std::dynamic_pointer_cast<ScrollViewShadowNode::ConcreteState const>(state));
_state = std::static_pointer_cast<ScrollViewShadowNode::ConcreteState const>(state);
@@ -73,9 +73,9 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)updateProps:(facebook::react::Props::Shared const &)props
oldProps:(facebook::react::Props::Shared const &)oldProps NS_REQUIRES_SUPER;
- (void)updateEventEmitter:(facebook::react::SharedEventEmitter)eventEmitter NS_REQUIRES_SUPER;
- (void)updateLayoutMetrics:(facebook::react::LayoutMetrics)layoutMetrics
oldLayoutMetrics:(facebook::react::LayoutMetrics)oldLayoutMetrics NS_REQUIRES_SUPER;
- (void)updateEventEmitter:(facebook::react::EventEmitter::Shared const &)eventEmitter NS_REQUIRES_SUPER;
- (void)updateLayoutMetrics:(facebook::react::LayoutMetrics const &)layoutMetrics
oldLayoutMetrics:(facebook::react::LayoutMetrics const &)oldLayoutMetrics NS_REQUIRES_SUPER;
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask NS_REQUIRES_SUPER;
- (void)prepareForRecycle NS_REQUIRES_SUPER;
@@ -243,13 +243,14 @@ using namespace facebook::react;
_needsInvalidateLayer = _needsInvalidateLayer || needsInvalidateLayer;
}
- (void)updateEventEmitter:(SharedEventEmitter)eventEmitter
- (void)updateEventEmitter:(EventEmitter::Shared const &)eventEmitter
{
assert(std::dynamic_pointer_cast<ViewEventEmitter const>(eventEmitter));
_eventEmitter = std::static_pointer_cast<ViewEventEmitter const>(eventEmitter);
}
- (void)updateLayoutMetrics:(LayoutMetrics)layoutMetrics oldLayoutMetrics:(LayoutMetrics)oldLayoutMetrics
- (void)updateLayoutMetrics:(LayoutMetrics const &)layoutMetrics
oldLayoutMetrics:(LayoutMetrics const &)oldLayoutMetrics
{
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
@@ -84,22 +84,23 @@ typedef NS_OPTIONS(NSInteger, RNComponentViewUpdateMask) {
* Called for updating component's state.
* Receiver must update native view according to changed state.
*/
- (void)updateState:(facebook::react::State::Shared)state oldState:(facebook::react::State::Shared)oldState;
- (void)updateState:(facebook::react::State::Shared const &)state
oldState:(facebook::react::State::Shared const &)oldState;
/*
* Called for updating component's event handlers set.
* Receiver must cache `eventEmitter` object inside and use it for emitting
* events when needed.
*/
- (void)updateEventEmitter:(facebook::react::SharedEventEmitter)eventEmitter;
- (void)updateEventEmitter:(facebook::react::EventEmitter::Shared const &)eventEmitter;
/*
* Called for updating component's layout metrics.
* Receiver must update `UIView` layout-related fields (such as `frame`,
* `bounds`, `layer.zPosition`, and so on) accordingly.
*/
- (void)updateLayoutMetrics:(facebook::react::LayoutMetrics)layoutMetrics
oldLayoutMetrics:(facebook::react::LayoutMetrics)oldLayoutMetrics;
- (void)updateLayoutMetrics:(facebook::react::LayoutMetrics const &)layoutMetrics
oldLayoutMetrics:(facebook::react::LayoutMetrics const &)oldLayoutMetrics;
/*
* Called right after all update methods were called for a particular component view.
@@ -25,15 +25,16 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateProps:(facebook::react::Props::Shared const &)props
oldProps:(facebook::react::Props::Shared const &)oldProps;
- (void)updateEventEmitter:(facebook::react::SharedEventEmitter)eventEmitter;
- (void)updateEventEmitter:(facebook::react::EventEmitter::Shared const &)eventEmitter;
- (void)updateLocalData:(facebook::react::SharedLocalData)localData
oldLocalData:(facebook::react::SharedLocalData)oldLocalData;
- (void)updateState:(facebook::react::State::Shared)state oldState:(facebook::react::State::Shared)oldState;
- (void)updateState:(facebook::react::State::Shared const &)state
oldState:(facebook::react::State::Shared const &)oldState;
- (void)updateLayoutMetrics:(facebook::react::LayoutMetrics)layoutMetrics
oldLayoutMetrics:(facebook::react::LayoutMetrics)oldLayoutMetrics;
- (void)updateLayoutMetrics:(facebook::react::LayoutMetrics const &)layoutMetrics
oldLayoutMetrics:(facebook::react::LayoutMetrics const &)oldLayoutMetrics;
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask;
@@ -44,7 +44,7 @@ using namespace facebook::react;
// Default implementation does nothing.
}
- (void)updateEventEmitter:(SharedEventEmitter)eventEmitter
- (void)updateEventEmitter:(EventEmitter::Shared const &)eventEmitter
{
// Default implementation does nothing.
}
@@ -54,12 +54,14 @@ using namespace facebook::react;
// Default implementation does nothing.
}
- (void)updateState:(facebook::react::State::Shared)state oldState:(facebook::react::State::Shared)oldState
- (void)updateState:(facebook::react::State::Shared const &)state
oldState:(facebook::react::State::Shared const &)oldState
{
// Default implementation does nothing.
}
- (void)updateLayoutMetrics:(LayoutMetrics)layoutMetrics oldLayoutMetrics:(LayoutMetrics)oldLayoutMetrics
- (void)updateLayoutMetrics:(LayoutMetrics const &)layoutMetrics
oldLayoutMetrics:(LayoutMetrics const &)oldLayoutMetrics
{
if (layoutMetrics.frame != oldLayoutMetrics.frame) {
CGRect frame = RCTCGRectFromRect(layoutMetrics.frame);