Device: Use std::unique_ptr instead of raw pointers
Instead of using raw pointers, use `std::unique_ptr`.
Bug: b/126126820
Change-Id: Ia095f6aec1448c2153a0b0159f25a2946054e64b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43813
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Device/VertexProcessor.cpp b/src/Device/VertexProcessor.cpp
index f069c1c..c7c403c 100644
--- a/src/Device/VertexProcessor.cpp
+++ b/src/Device/VertexProcessor.cpp
@@ -57,20 +57,12 @@
VertexProcessor::VertexProcessor()
{
- routineCache = nullptr;
setRoutineCacheSize(1024);
}
-VertexProcessor::~VertexProcessor()
-{
- delete routineCache;
- routineCache = nullptr;
-}
-
void VertexProcessor::setRoutineCacheSize(int cacheSize)
{
- delete routineCache;
- routineCache = new RoutineCacheType(clamp(cacheSize, 1, 65536));
+ routineCache = std::make_unique<RoutineCacheType>(clamp(cacheSize, 1, 65536));
}
const VertexProcessor::State VertexProcessor::update(const sw::Context *context)