TextLine cache is used, even for long lines of text.
Bug 3381368
The 250 characters limit is passed for long URLs. There are only 3
TextLine objects, so their total size is not an issue. Recycle long
lines as well to make sure we fill the cache and avoid object creation.
Change-Id: I843bf623594312a0fcf0edbb13b7cd64cce0ddd1
diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java
index a6fd2f1..90279d1 100644
--- a/core/java/android/text/TextLine.java
+++ b/core/java/android/text/TextLine.java
@@ -90,13 +90,11 @@
tl.mText = null;
tl.mPaint = null;
tl.mDirections = null;
- if (tl.mLen < 250) {
- synchronized(cached) {
- for (int i = 0; i < cached.length; ++i) {
- if (cached[i] == null) {
- cached[i] = tl;
- break;
- }
+ synchronized(cached) {
+ for (int i = 0; i < cached.length; ++i) {
+ if (cached[i] == null) {
+ cached[i] = tl;
+ break;
}
}
}