From 36d895ce210caf5e190891ee3e18f7853a711242 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sat, 7 Dec 2019 22:45:50 -0800 Subject: [PATCH] Fabric: Enabling new TextMeasureCache thing for Android Summary: Read more about this in D18848583 (where it's implemented for iOS). This diff enables that for Android. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D18869823 fbshipit-source-id: ebdc863ec07268119d1cbbb911760532bb28ee04 --- .../platform/android/TextLayoutManager.cpp | 4 ++-- .../platform/android/TextLayoutManager.h | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp b/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp index 9c96296129e..c5d38147b62 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp +++ b/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp @@ -29,8 +29,8 @@ Size TextLayoutManager::measure( auto &attributedString = attributedStringBox.getValue(); return measureCache_.get( - MeasureCacheKey{attributedString, paragraphAttributes, layoutConstraints}, - [&](MeasureCacheKey const &key) { + {attributedString, paragraphAttributes, layoutConstraints}, + [&](TextMeasureCacheKey const &key) { return doMeasure( attributedString, paragraphAttributes, layoutConstraints); }); diff --git a/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h b/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h index 06551d178d3..215ef8adab3 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h +++ b/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h @@ -7,14 +7,11 @@ #pragma once -#include - #include #include -#include #include +#include #include -#include namespace facebook { namespace react { @@ -52,13 +49,9 @@ class TextLayoutManager { ParagraphAttributes paragraphAttributes, LayoutConstraints layoutConstraints) const; - using MeasureCacheKey = - std::tuple; - using MeasureCache = SimpleThreadSafeCache; - void *self_; ContextContainer::Shared contextContainer_; - MeasureCache measureCache_{}; + TextMeasureCache measureCache_{}; }; } // namespace react