From 8a0b238b1344dae0042bbb17b71c0c3b9b881f22 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 18 Oct 2017 15:07:33 -0700 Subject: AAPT2: Ensure strings are sorted by configuration Keep strings sorted by configuration so that strings likely to be selected (all match the same locale, for instance) are close together. Bug: 67958501 Test: make aapt2_tests Change-Id: Id17d93bf2e03ce408a6f619d3ea6dc313e393b76 --- tools/aapt2/StringPool.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tools/aapt2/StringPool.cpp') diff --git a/tools/aapt2/StringPool.cpp b/tools/aapt2/StringPool.cpp index 705b1ab052af..3a1a18c01e1c 100644 --- a/tools/aapt2/StringPool.cpp +++ b/tools/aapt2/StringPool.cpp @@ -191,6 +191,13 @@ StringPool::Ref StringPool::MakeRefImpl(const StringPiece& str, const Context& c return Ref(borrow); } +StringPool::Ref StringPool::MakeRef(const Ref& ref) { + if (ref.entry_->pool_ == this) { + return ref; + } + return MakeRef(ref.entry_->value, ref.entry_->context); +} + StringPool::StyleRef StringPool::MakeRef(const StyleString& str) { return MakeRef(str, Context{}); } -- cgit v1.2.3-59-g8ed1b