Skip to content

Commit

Permalink
Delete feature flag enable_simulate_image_props_memory_access
Browse files Browse the repository at this point in the history
Summary:
changelog: [internal]

Clean up unused feature flag

Reviewed By: fkgozali

Differential Revision: D42709723

fbshipit-source-id: 289697dfb0c0378ff0369e1474150f7be68c8635
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Jan 25, 2023
1 parent 8863be4 commit 6f7428e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 54 deletions.
4 changes: 0 additions & 4 deletions React/Fabric/RCTScheduler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ - (instancetype)initWithToolbox:(SchedulerToolbox)toolbox
_layoutAnimationDelegateProxy = std::make_shared<LayoutAnimationDelegateProxy>((__bridge void *)self);
_animationDriver = std::make_shared<LayoutAnimationDriver>(
toolbox.runtimeExecutor, toolbox.contextContainer, _layoutAnimationDelegateProxy.get());

if (reactNativeConfig->getBool("react_fabric:enable_simulate_image_props_memory_access")) {
_animationDriver->enableSimulateImagePropsMemoryAccess();
}
_uiRunLoopObserver =
toolbox.mainRunLoopObserverFactory(RunLoopObserver::Activity::BeforeWaiting, _layoutAnimationDelegateProxy);
_uiRunLoopObserver->setDelegate(_layoutAnimationDelegateProxy.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ LayoutAnimationKeyFrameManager::pullTransaction(
MountingTransaction::Number transactionNumber,
TransactionTelemetry const &telemetry,
ShadowViewMutationList mutations) const {
simulateImagePropsMemoryAccess(mutations);
// Current time in milliseconds
uint64_t now = now_();

Expand Down Expand Up @@ -1086,8 +1085,6 @@ LayoutAnimationKeyFrameManager::pullTransaction(
}
}

simulateImagePropsMemoryAccess(mutations);

return MountingTransaction{
surfaceId, transactionNumber, std::move(mutations), telemetry};
}
Expand All @@ -1108,10 +1105,6 @@ void LayoutAnimationKeyFrameManager::setClockNow(
now_ = std::move(now);
}

void LayoutAnimationKeyFrameManager::enableSimulateImagePropsMemoryAccess() {
simulateImagePropsMemoryAccess_ = true;
}

#pragma mark - Protected

bool LayoutAnimationKeyFrameManager::hasComponentDescriptorForShadowView(
Expand Down Expand Up @@ -1665,39 +1658,4 @@ void LayoutAnimationKeyFrameManager::deleteAnimationsForStoppedSurfaces()
}
}

void LayoutAnimationKeyFrameManager::simulateImagePropsMemoryAccess(
ShadowViewMutationList const &mutations) const {
if (!simulateImagePropsMemoryAccess_) {
return;
}
for (auto const &mutation : mutations) {
if (mutation.type != ShadowViewMutation::Type::Insert) {
continue;
}
if (strcmp(mutation.newChildShadowView.componentName, "Image") == 0) {
auto const &imageProps = *std::static_pointer_cast<ImageProps const>(
mutation.newChildShadowView.props);
int temp = 0;
switch (imageProps.resizeMode) {
case ImageResizeMode::Cover:
temp = 1;
break;
case ImageResizeMode::Contain:
temp = 2;
break;
case ImageResizeMode::Stretch:
temp = 3;
break;
case ImageResizeMode::Center:
temp = 4;
break;
case ImageResizeMode::Repeat:
temp = 5;
break;
}
(void)temp;
}
}
}

} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate,

void setClockNow(std::function<uint64_t()> now);

void enableSimulateImagePropsMemoryAccess();

protected:
SharedComponentDescriptorRegistry componentDescriptorRegistry_;
mutable std::optional<LayoutAnimation> currentAnimation_{};
Expand Down Expand Up @@ -150,12 +148,6 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate,
mutable butter::set<SurfaceId> surfaceIdsToStop_{};
bool reduceDeleteCreateMutation_{false};

/*
* Feature flag that enables simulation of memory access. This is a temporary
* flag to diagnose where crashes are coming from in LayoutAnimations on iOS.
*/
bool simulateImagePropsMemoryAccess_{false};

// Function that returns current time in milliseconds
std::function<uint64_t()> now_;

Expand Down

0 comments on commit 6f7428e

Please sign in to comment.