diff options
author | Chris Craik <ccraik@google.com> | 2014-12-22 17:16:56 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-12-23 16:53:56 -0800 |
commit | 51d6a3db97bdd5315f1a17a4b447d10a92217b98 (patch) | |
tree | 80803f8d2a5507e2d29bd58c7243a23fca343454 /libs/hwui/ProgramCache.cpp | |
parent | e84a208317e0ed388fcdad1e6743c7849acb51b0 (diff) | |
download | frameworks_base-51d6a3db97bdd5315f1a17a4b447d10a92217b98.zip frameworks_base-51d6a3db97bdd5315f1a17a4b447d10a92217b98.tar.gz frameworks_base-51d6a3db97bdd5315f1a17a4b447d10a92217b98.tar.bz2 |
Cleanup various clang warnings, use unique_ptrs in several places
Change-Id: I347904b25e51fcc7de14b1e72f1acd0f6ba26f3f
Diffstat (limited to 'libs/hwui/ProgramCache.cpp')
-rw-r--r-- | libs/hwui/ProgramCache.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp index 62835e0..6d3f0cb 100644 --- a/libs/hwui/ProgramCache.cpp +++ b/libs/hwui/ProgramCache.cpp @@ -417,11 +417,6 @@ ProgramCache::~ProgramCache() { void ProgramCache::clear() { PROGRAM_LOGD("Clearing program cache"); - - size_t count = mCache.size(); - for (size_t i = 0; i < count; i++) { - delete mCache.valueAt(i); - } mCache.clear(); } @@ -433,14 +428,14 @@ Program* ProgramCache::get(const ProgramDescription& description) { key = PROGRAM_KEY_TEXTURE; } - ssize_t index = mCache.indexOfKey(key); + auto iter = mCache.find(key); Program* program = NULL; - if (index < 0) { + if (iter == mCache.end()) { description.log("Could not find program"); program = generateProgram(description, key); - mCache.add(key, program); + mCache[key] = std::unique_ptr<Program>(program); } else { - program = mCache.valueAt(index); + program = iter->second.get(); } return program; } |