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>
This commit is contained in:
Herb Derby 2020-10-27 13:38:32 -04:00 committed by Skia Commit-Bot
parent f548a028ce
commit 2acd43d7c9
3 changed files with 10 additions and 10 deletions

View File

@ -46,7 +46,7 @@ void GrGLPathRendering::onDrawPath(const GrStencilSettings&, const GrPath*) {}
void GrGLPathRendering::onStencilPath(const StencilPathArgs&, const GrPath*) {}
std::unique_ptr<GrOp> GrStencilPathOp::Make(GrRecordingContext*,
GrOp::Owner GrStencilPathOp::Make(GrRecordingContext*,
const SkMatrix&,
bool,
bool,

View File

@ -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<GrOp, DeleteFromPool>;
#endif
@ -101,7 +101,7 @@ public:
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};

View File

@ -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>(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)};