renderengine: move away from "new"
Replace "new" by either of std::vector or std::make_unique.
Bug: 115738279
Test: boots
Change-Id: I45704b34d668198ece741894829d752035dafff6
diff --git a/services/surfaceflinger/RenderEngine/gl/ProgramCache.cpp b/services/surfaceflinger/RenderEngine/gl/ProgramCache.cpp
index 1e7e93c..6d431b6 100644
--- a/services/surfaceflinger/RenderEngine/gl/ProgramCache.cpp
+++ b/services/surfaceflinger/RenderEngine/gl/ProgramCache.cpp
@@ -77,10 +77,6 @@
return f;
}
-ProgramCache::ProgramCache() {}
-
-ProgramCache::~ProgramCache() {}
-
void ProgramCache::primeCache(bool useColorManagement) {
uint32_t shaderCount = 0;
uint32_t keyMask = Key::BLEND_MASK | Key::OPACITY_MASK | Key::ALPHA_MASK | Key::TEXTURE_MASK;
@@ -646,7 +642,7 @@
return fs.getString();
}
-Program* ProgramCache::generateProgram(const Key& needs) {
+std::unique_ptr<Program> ProgramCache::generateProgram(const Key& needs) {
ATRACE_CALL();
// vertex shader
@@ -655,8 +651,7 @@
// fragment shader
String8 fs = generateFragmentShader(needs);
- Program* program = new Program(needs, vs.string(), fs.string());
- return program;
+ return std::make_unique<Program>(needs, vs.string(), fs.string());
}
void ProgramCache::useProgram(const Description& description) {
@@ -676,7 +671,7 @@
}
// here we have a suitable program for this description
- Program* program = it->second;
+ std::unique_ptr<Program>& program = it->second;
if (program->isValid()) {
program->use();
program->setUniforms(description);