X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/98b110d13e1d5b0a21bb3c97b4da56d23132a643..c232174f12d3df4a0acee19bfd1ce3ffb33b0fe2:/ResourceTable.cpp?ds=sidebyside diff --git a/ResourceTable.cpp b/ResourceTable.cpp index 3d7b088..52ebaf0 100644 --- a/ResourceTable.cpp +++ b/ResourceTable.cpp @@ -8,6 +8,7 @@ #include "XMLNode.h" #include "ResourceFilter.h" +#include "ResourceIdCache.h" #include #include @@ -1998,6 +1999,9 @@ uint32_t ResourceTable::getResId(const String16& package, const String16& name, bool onlyPublic) const { + uint32_t id = ResourceIdCache::lookup(package, type, name, onlyPublic); + if (id != 0) return id; // cache hit + sp p = mPackages.valueFor(package); if (p == NULL) return 0; @@ -2016,11 +2020,10 @@ uint32_t ResourceTable::getResId(const String16& package, } if (Res_INTERNALID(rid)) { - return rid; + return ResourceIdCache::store(package, type, name, onlyPublic, rid); } - return Res_MAKEID(p->getAssignedId()-1, - Res_GETTYPE(rid), - Res_GETENTRY(rid)); + return ResourceIdCache::store(package, type, name, onlyPublic, + Res_MAKEID(p->getAssignedId()-1, Res_GETTYPE(rid), Res_GETENTRY(rid))); } sp t = p->getTypes().valueFor(type); @@ -2029,7 +2032,9 @@ uint32_t ResourceTable::getResId(const String16& package, if (c == NULL) return 0; int32_t ei = c->getEntryIndex(); if (ei < 0) return 0; - return getResId(p, t, ei); + + return ResourceIdCache::store(package, type, name, onlyPublic, + getResId(p, t, ei)); } uint32_t ResourceTable::getResId(const String16& ref,