287 {
292
295
300 1,
304 {});
306 for (bool doInstantiate : {true, false}) {
307 for (bool releaseCallback : {false, true}) {
309
310 class TestCallback {
311 public:
314 , fReleaseCallback(releaseCallback)
315 , fTexture(
std::move(tex)) {}
316 TestCallback(
const TestCallback& that) {
SkASSERT(0); }
317 TestCallback(TestCallback&& that)
318 : fValue(that.fValue)
319 , fReleaseCallback(that.fReleaseCallback)
320 , fTexture(
std::move(that.fTexture)) {
321 that.fValue = nullptr;
322 }
323
324 ~TestCallback() { fValue ? (void)(*fValue = -1) : void(); }
325
326 TestCallback& operator=(TestCallback&& that) {
327 fValue = std::exchange(that.fValue, nullptr);
328 return *this;
329 }
330 TestCallback& operator=(const TestCallback& that) = delete;
331
334 *fValue = 1;
335 return {fTexture, fReleaseCallback};
336 }
337
338 private:
339 int* fValue = nullptr;
340 bool fReleaseCallback;
342 };
344 proxyProvider->createLazyProxy(TestCallback(&
testCount, releaseCallback, tex),
354 {});
355
358
359 if (doInstantiate) {
361 if (releaseCallback) {
362
363
365 } else {
367 }
370 } else {
373 }
374 }
375 }
376}
static const size_t testCount
const GrCaps * caps() const
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
GrResourceProvider * resourceProvider()
sk_sp< GrTexture > createTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, skgpu::Renderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped mipmapped, skgpu::Budgeted budgeted, skgpu::Protected isProtected, std::string_view label)
bool doLazyInstantiation(GrResourceProvider *)
GrSurfaceProxyPriv priv()
void reset(T *ptr=nullptr)
uint32_t uint32_t * format