diff options
| author | 2017-05-23 18:01:09 +0000 | |
|---|---|---|
| committer | 2017-05-23 18:01:09 +0000 | |
| commit | 45ef07f762575b462b08b7c9ed4a3e80f8a671b6 (patch) | |
| tree | 38bfd79c37d0e1ba120a62d9d849ffa9e6304308 /libs/hwui/TextureCache.cpp | |
| parent | e82df3f7b6c1784e3ac5e8f2b8d43923fd9bb959 (diff) | |
| parent | 9d08fca62fbe140ffa107dd0f216282971af6748 (diff) | |
Merge "Improve time to texture destruction" into oc-dev am: 1bc0286ef8
am: 9d08fca62f
Change-Id: Iee16d786983734d138a408707cf5efd9f9c9b9fb
Diffstat (limited to 'libs/hwui/TextureCache.cpp')
| -rw-r--r-- | libs/hwui/TextureCache.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp index 63a6a2c8c89c..710cdd9286e8 100644 --- a/libs/hwui/TextureCache.cpp +++ b/libs/hwui/TextureCache.cpp @@ -191,25 +191,14 @@ Texture* TextureCache::get(Bitmap* bitmap) { return texture; } -void TextureCache::releaseTexture(uint32_t pixelRefStableID) { - Mutex::Autolock _l(mLock); - mGarbage.push_back(pixelRefStableID); -} - -void TextureCache::clearGarbage() { - Mutex::Autolock _l(mLock); - size_t count = mGarbage.size(); - for (size_t i = 0; i < count; i++) { - uint32_t pixelRefId = mGarbage[i]; - auto hardwareIter = mHardwareTextures.find(pixelRefId); - if (hardwareIter == mHardwareTextures.end()) { - mCache.remove(pixelRefId); - } else { - hardwareIter->second->deleteTexture(); - mHardwareTextures.erase(hardwareIter); - } +bool TextureCache::destroyTexture(uint32_t pixelRefStableID) { + auto hardwareIter = mHardwareTextures.find(pixelRefStableID); + if (hardwareIter != mHardwareTextures.end()) { + hardwareIter->second->deleteTexture(); + mHardwareTextures.erase(hardwareIter); + return true; } - mGarbage.clear(); + return mCache.remove(pixelRefStableID); } void TextureCache::clear() { |