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:
parent
f548a028ce
commit
2acd43d7c9
@ -46,11 +46,11 @@ void GrGLPathRendering::onDrawPath(const GrStencilSettings&, const GrPath*) {}
|
||||
|
||||
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*) {}
|
||||
|
@ -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};
|
||||
|
@ -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)};
|
||||
|
Loading…
Reference in New Issue
Block a user