mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add feature flag to enable / disable SpannableCache in TextLayoutManagerMapBuffer
Summary: Quick diff to add feature flag to enable / disable SpannableCache in TextLayoutManagerMapBuffer changelog: [internal] internal Reviewed By: genkikondo Differential Revision: D36498646 fbshipit-source-id: 4cabb75441ddbafeff65f3e9b2df6a38431a996a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
089ff4555a
commit
d315e9c743
+17
-10
@@ -29,6 +29,7 @@ import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.common.mapbuffer.MapBuffer;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.yoga.YogaConstants;
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
@@ -205,19 +206,25 @@ public class TextLayoutManagerMapBuffer {
|
||||
|
||||
Spannable preparedSpannableText;
|
||||
|
||||
synchronized (sSpannableCacheLock) {
|
||||
preparedSpannableText = sSpannableCache.get(attributedString);
|
||||
if (preparedSpannableText != null) {
|
||||
return preparedSpannableText;
|
||||
if (ReactFeatureFlags.enableSpannableCache) {
|
||||
synchronized (sSpannableCacheLock) {
|
||||
preparedSpannableText = sSpannableCache.get(attributedString);
|
||||
if (preparedSpannableText != null) {
|
||||
return preparedSpannableText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
preparedSpannableText =
|
||||
createSpannableFromAttributedString(
|
||||
context, attributedString, reactTextViewManagerCallback);
|
||||
preparedSpannableText =
|
||||
createSpannableFromAttributedString(
|
||||
context, attributedString, reactTextViewManagerCallback);
|
||||
|
||||
synchronized (sSpannableCacheLock) {
|
||||
sSpannableCache.put(attributedString, preparedSpannableText);
|
||||
synchronized (sSpannableCacheLock) {
|
||||
sSpannableCache.put(attributedString, preparedSpannableText);
|
||||
}
|
||||
} else {
|
||||
preparedSpannableText =
|
||||
createSpannableFromAttributedString(
|
||||
context, attributedString, reactTextViewManagerCallback);
|
||||
}
|
||||
|
||||
return preparedSpannableText;
|
||||
|
||||
Reference in New Issue
Block a user