switch unique_ptr with deleter to GrMemoryPool
I switched GrOps from using GrOpMemoryPool to
GrMemoryPool, but I forgot to switch over the
GrOp::Owner. Make sure the GrOp::Owner works for
both new/delete and GrMemoryPool.
In addition, convert one last unique_ptr<GrOp> to
GrOp::Owner.
Change-Id: I660ad77bee0f060f263ff2ed07974afb83063441
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330097
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/gpu/GrPathRendering_none.cpp b/src/gpu/GrPathRendering_none.cpp
index 048e8a3..9e73eda 100644
--- a/src/gpu/GrPathRendering_none.cpp
+++ b/src/gpu/GrPathRendering_none.cpp
@@ -46,11 +46,11 @@
void GrGLPathRendering::onStencilPath(const StencilPathArgs&, const GrPath*) {}
-std::unique_ptr<GrOp> GrStencilPathOp::Make(GrRecordingContext*,
- const SkMatrix&,
- bool,
- bool,
- const GrScissorState&,
- sk_sp<const GrPath>) { return nullptr; }
+GrOp::Owner GrStencilPathOp::Make(GrRecordingContext*,
+ const SkMatrix&,
+ bool,
+ bool,
+ const GrScissorState&,
+ sk_sp<const GrPath>) { return nullptr; }
void GrPath::ComputeKey(const GrStyledShape&, GrUniqueKey*, bool*) {}
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index 15f3bb4..a1dcd84 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -73,9 +73,9 @@
#else
struct DeleteFromPool {
DeleteFromPool() : fPool{nullptr} {}
- DeleteFromPool(GrOpMemoryPool* pool) : fPool{pool} {}
+ DeleteFromPool(GrMemoryPool* pool) : fPool{pool} {}
void operator() (GrOp* op);
- GrOpMemoryPool* fPool;
+ GrMemoryPool* fPool;
};
using Owner = std::unique_ptr<GrOp, DeleteFromPool>;
#endif
@@ -101,7 +101,7 @@
template<typename Op, typename... Args>
static Owner MakeWithExtraMemory(
GrRecordingContext* context, size_t extraSize, Args&&... args) {
- GrOpMemoryPool* pool = context->priv().opMemoryPool();
+ GrMemoryPool* pool = context->priv().opMemoryPool();
void* mem = pool->allocate(sizeof(Op) + extraSize);
GrOp* op = new (mem) Op(std::forward<Args>(args)...);
return Owner{op, pool};
diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
index b016050..181249c 100644
--- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
+++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
@@ -199,7 +199,7 @@
GrProcessorSet* processorSet = new (setMem) GrProcessorSet{std::move(paint)};
return Owner{new (bytes) Op(processorSet, color, std::forward<Args>(args)...)};
#else
- GrOpMemoryPool* pool = context->priv().opMemoryPool();
+ GrMemoryPool* pool = context->priv().opMemoryPool();
char* bytes = (char*)pool->allocate(sizeof(Op) + sizeof(GrProcessorSet));
char* setMem = bytes + sizeof(Op);
GrProcessorSet* processorSet = new (setMem) GrProcessorSet{std::move(paint)};