From 2acd43d7c9ba72e4a950ba76425ddba5610a2009 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Tue, 27 Oct 2020 13:38:32 -0400 Subject: [PATCH] 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 to GrOp::Owner. Change-Id: I660ad77bee0f060f263ff2ed07974afb83063441 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330097 Commit-Queue: Herb Derby Reviewed-by: Mike Klein --- src/gpu/GrPathRendering_none.cpp | 12 ++++++------ src/gpu/ops/GrOp.h | 6 +++--- src/gpu/ops/GrSimpleMeshDrawOpHelper.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gpu/GrPathRendering_none.cpp b/src/gpu/GrPathRendering_none.cpp index 048e8a3020..9e73eda7a7 100644 --- a/src/gpu/GrPathRendering_none.cpp +++ b/src/gpu/GrPathRendering_none.cpp @@ -46,11 +46,11 @@ void GrGLPathRendering::onDrawPath(const GrStencilSettings&, const GrPath*) {} void GrGLPathRendering::onStencilPath(const StencilPathArgs&, const GrPath*) {} -std::unique_ptr GrStencilPathOp::Make(GrRecordingContext*, - const SkMatrix&, - bool, - bool, - const GrScissorState&, - sk_sp) { return nullptr; } +GrOp::Owner GrStencilPathOp::Make(GrRecordingContext*, + const SkMatrix&, + bool, + bool, + const GrScissorState&, + sk_sp) { return nullptr; } void GrPath::ComputeKey(const GrStyledShape&, GrUniqueKey*, bool*) {} diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h index 15f3bb43ee..a1dcd847e3 100644 --- a/src/gpu/ops/GrOp.h +++ b/src/gpu/ops/GrOp.h @@ -73,9 +73,9 @@ public: #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; #endif @@ -101,7 +101,7 @@ public: template 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)...); return Owner{op, pool}; diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h index b016050025..181249c3cf 100644 --- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h +++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h @@ -199,7 +199,7 @@ GrOp::Owner GrOp::MakeWithProcessorSet( GrProcessorSet* processorSet = new (setMem) GrProcessorSet{std::move(paint)}; return Owner{new (bytes) Op(processorSet, color, std::forward(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)};