Enable ClangTidy check modernize-make-unique.
The majority of existing call sites were automatically updated using
clang-tidy -fix. A small handful required a manual update,
e.g. CppCodeGen.
This check is a bit lenient, and in particular will not flag cases like
`std::unique_ptr<Base>(new Derived())` which is still pretty common
throughout our codebase. This CL does not attempt to replace all the
cases that ClangTidy does not flag.
Change-Id: I5eba48ef880e25d22de80f321a68c389ba769e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307459
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 5677f29..9343bbe 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -7,6 +7,8 @@
#include "src/gpu/GrDrawingManager.h"
+#include <memory>
+
#include "include/core/SkDeferredDisplayList.h"
#include "include/gpu/GrBackendSemaphore.h"
#include "include/gpu/GrDirectContext.h"
@@ -915,7 +917,8 @@
GrPathRenderer::StencilSupport* stencilSupport) {
if (!fPathRendererChain) {
- fPathRendererChain.reset(new GrPathRendererChain(fContext, fOptionsForPathRendererChain));
+ fPathRendererChain =
+ std::make_unique<GrPathRendererChain>(fContext, fOptionsForPathRendererChain);
}
GrPathRenderer* pr = fPathRendererChain->getPathRenderer(args, drawType, stencilSupport);
@@ -946,7 +949,7 @@
GrCoverageCountingPathRenderer* GrDrawingManager::getCoverageCountingPathRenderer() {
if (!fPathRendererChain) {
- fPathRendererChain.reset(new GrPathRendererChain(fContext, fOptionsForPathRendererChain));
+ fPathRendererChain = std::make_unique<GrPathRendererChain>(fContext, fOptionsForPathRendererChain);
}
return fPathRendererChain->getCoverageCountingPathRenderer();
}