Cleanup various clang warnings, use unique_ptrs in several places

Change-Id: I347904b25e51fcc7de14b1e72f1acd0f6ba26f3f
This commit is contained in:
Chris Craik
2014-12-22 17:16:56 -08:00
parent e84a208317
commit 51d6a3db97
30 changed files with 133 additions and 226 deletions

View File

@ -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;
}