Add fast path for tail insertion in GrResourceAllocator::IntervalList
Change-Id: I8953036d61b4ea4989c8722f536db9cd520a1e24
Reviewed-on: https://skia-review.googlesource.com/146167
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h
index fc3d031..21528b0 100644
--- a/src/gpu/GrResourceAllocator.h
+++ b/src/gpu/GrResourceAllocator.h
@@ -124,6 +124,7 @@
void resetTo(GrSurfaceProxy* proxy, unsigned int start, unsigned int end) {
SkASSERT(proxy);
+ SkASSERT(!fNext);
fProxy = proxy;
fProxyID = proxy->uniqueID().asUInt();
@@ -192,7 +193,10 @@
// Since the arena allocator will clean up for us we don't bother here.
}
- bool empty() const { return !SkToBool(fHead); }
+ bool empty() const {
+ SkASSERT(SkToBool(fHead) == SkToBool(fTail));
+ return !SkToBool(fHead);
+ }
const Interval* peekHead() const { return fHead; }
Interval* popHead();
void insertByIncreasingStart(Interval*);
@@ -200,7 +204,10 @@
Interval* detachAll();
private:
+ SkDEBUGCODE(void validate() const;)
+
Interval* fHead = nullptr;
+ Interval* fTail = nullptr;
};
// Gathered statistics indicate that 99% of flushes will be covered by <= 12 Intervals