src/gpu/GrResourceAllocator.cpp
void GrResourceAllocator::recycleSurface(sk_sp<GrSurface> surface) {
    const GrScratchKey &key = surface->resourcePriv().getScratchKey();

    if (!key.isValid()) {
        return; // can't do it w/o a valid scratch key
    }

    if (surface->getUniqueKey().isValid()) {
        // If the surface has a unique key we throw it back into the resource cache.
        // If things get really tight 'findSurfaceFor' may pull it back out but there is
        // no need to have it in tight rotation.
        return;
    }

#if GR_ALLOCATION_SPEW
    SkDebugf("putting surface %d back into pool\n", surface->uniqueID().asUInt());
#endif
    // TODO: fix this insertion so we get a more LRU-ish behavior
    fFreePool.insert(key, surface.release());
}
// 'surface' can be reused. Add it back to the free pool.
'surface' can be reused. Add it back to the free pool.
' surface ' can be reused . Add it back to the free pool .
void GrResourceAllocator::recycleSurface(sk_sp<GrSurface> surface) {
    const GrScratchKey &key = surface->resourcePriv().getScratchKey();
    if (!key.isValid()) {
        return; 
    }
    if (surface->getUniqueKey().isValid()) {
        return;
    }
#if GR_ALLOCATION_SPEW
    SkDebugf("putting surface %d back into pool\n", surface->uniqueID().asUInt());
#endif
    fFreePool.insert(key, surface.release());
}
void GrResourceAllocator :: recycleSurface ( sk_sp < GrSurface > surface ) { const GrScratchKey & key = surface -> resourcePriv ( ) . getScratchKey ( ) ; if ( ! key . isValid ( ) ) { return ; } if ( surface -> getUniqueKey ( ) . isValid ( ) ) { return ; } #if GR_ALLOCATION_SPEW SkDebugf ( " \n " , surface -> uniqueID ( ) . asUInt ( ) ) ; #endif fFreePool . insert ( key , surface . release ( ) ) ; }
'surface' can be reused.
' surface ' can be reused .
// can't do it w/o a valid scratch key // If the surface has a unique key we throw it back into the resource cache. // If things get really tight 'findSurfaceFor' may pull it back out but there is // no need to have it in tight rotation. // TODO: fix this insertion so we get a more LRU-ish behavior