diff options
| author | Dianne Hackborn <hackbod@google.com> | 2009-07-06 11:07:40 -0700 | 
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2009-07-06 11:12:37 -0700 | 
| commit | 78c405178c57bb45e40f1e2839d6a18d91f7f02c (patch) | |
| tree | 6e7137f628b8fff1f72c59e5e42f3f4878e0bb39 /include/utils | |
| parent | ef1f21b34f5624adb7436d3da927660ed16c97c7 (diff) | |
| download | frameworks_base-78c405178c57bb45e40f1e2839d6a18d91f7f02c.zip frameworks_base-78c405178c57bb45e40f1e2839d6a18d91f7f02c.tar.gz frameworks_base-78c405178c57bb45e40f1e2839d6a18d91f7f02c.tar.bz2 | |
Don't re-parse the framework resources all the time.
A small optimization to the resource code, to not re-parse the framework
resources every time we build a new AssetManager.  Instead, you can now
construct a ResTable from a previously created one...  of course, like the
existing code for using the data in-place, you can't delete the original
ResTable until you have deleted the one that has been constructed from it.
Diffstat (limited to 'include/utils')
| -rw-r--r-- | include/utils/AssetManager.h | 11 | ||||
| -rw-r--r-- | include/utils/ResourceTypes.h | 1 | 
2 files changed, 10 insertions, 2 deletions
| diff --git a/include/utils/AssetManager.h b/include/utils/AssetManager.h index c11429e..d8994e0 100644 --- a/include/utils/AssetManager.h +++ b/include/utils/AssetManager.h @@ -251,6 +251,9 @@ private:          Asset* getResourceTableAsset();          Asset* setResourceTableAsset(Asset* asset); +        ResTable* getResourceTable(); +        ResTable* setResourceTable(ResTable* res); +                  bool isUpToDate();      protected: @@ -265,6 +268,7 @@ private:          time_t mModWhen;          Asset* mResourceTableAsset; +        ResTable* mResourceTable;          static Mutex gLock;          static DefaultKeyedVector<String8, wp<SharedZip> > gOpen; @@ -288,8 +292,11 @@ private:           */          ZipFileRO* getZip(const String8& path); -        Asset* getZipResourceTable(const String8& path); -        Asset* setZipResourceTable(const String8& path, Asset* asset); +        Asset* getZipResourceTableAsset(const String8& path); +        Asset* setZipResourceTableAsset(const String8& path, Asset* asset); + +        ResTable* getZipResourceTable(const String8& path); +        ResTable* setZipResourceTable(const String8& path, ResTable* res);          // generate path, e.g. "common/en-US-noogle.zip"          static String8 getPathName(const char* path); diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h index eb4151a..93bca4a 100644 --- a/include/utils/ResourceTypes.h +++ b/include/utils/ResourceTypes.h @@ -1580,6 +1580,7 @@ public:                   bool copyData=false);      status_t add(Asset* asset, void* cookie,                   bool copyData=false); +    status_t add(ResTable* src);      status_t getError() const; | 
