src/gpu/GrResourceAllocator.cpp
void GrResourceAllocator::expire(unsigned int curIndex) {
    while (!fActiveIntvls.empty() && fActiveIntvls.peekHead()->end() < curIndex) {
        Interval* temp = fActiveIntvls.popHead();
        SkASSERT(!temp->next());

        if (temp->wasAssignedSurface()) {
            sk_sp<GrSurface> surface = temp->detachSurface();

            if (temp->isRecyclable()) {
                this->recycleSurface(std::move(surface));
            }
        }

        // Add temp to the free interval list so it can be reused
        SkASSERT(!temp->wasAssignedSurface()); // it had better not have a ref on a surface
        temp->setNext(fFreeIntervalList);
        fFreeIntervalList = temp;
    }
}
// Remove any intervals that end before the current index. Return their GrSurfaces
// to the free pool if possible.
Remove any intervals that end before the current index. Return their GrSurfaces
to the free pool if possible.
Remove any intervals that end before the current index . Return their GrSurfaces to the free pool if possible .
void GrResourceAllocator::expire(unsigned int curIndex) {
    while (!fActiveIntvls.empty() && fActiveIntvls.peekHead()->end() < curIndex) {
        Interval* temp = fActiveIntvls.popHead();
        SkASSERT(!temp->next());
        if (temp->wasAssignedSurface()) {
            sk_sp<GrSurface> surface = temp->detachSurface();
            if (temp->isRecyclable()) {
                this->recycleSurface(std::move(surface));
            }
        }
        SkASSERT(!temp->wasAssignedSurface()); 
        temp->setNext(fFreeIntervalList);
        fFreeIntervalList = temp;
    }
}
void GrResourceAllocator :: expire ( unsigned int curIndex ) { while ( ! fActiveIntvls . empty ( ) && fActiveIntvls . peekHead ( ) -> end ( ) < curIndex ) { Interval * temp = fActiveIntvls . popHead ( ) ; SkASSERT ( ! temp -> next ( ) ) ; if ( temp -> wasAssignedSurface ( ) ) { sk_sp < GrSurface > surface = temp -> detachSurface ( ) ; if ( temp -> isRecyclable ( ) ) { this -> recycleSurface ( std :: move ( surface ) ) ; } } SkASSERT ( ! temp -> wasAssignedSurface ( ) ) ; temp -> setNext ( fFreeIntervalList ) ; fFreeIntervalList = temp ; } }
Remove any intervals that end before the current index.
Remove any intervals that end before the current index .
// Add temp to the free interval list so it can be reused // it had better not have a ref on a surface