Purge the SkLiteDL freelist when PurgeAllCaches() is called.
Seems like the polite thing to do. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2228953002 Review-Url: https://codereview.chromium.org/2228953002
This commit is contained in:
parent
8369e32a05
commit
0c753e5c26
@ -14,6 +14,7 @@
|
||||
#include "SkGeometry.h"
|
||||
#include "SkGlyphCache.h"
|
||||
#include "SkImageFilter.h"
|
||||
#include "SkLiteDL.h"
|
||||
#include "SkMath.h"
|
||||
#include "SkMatrix.h"
|
||||
#include "SkOpts.h"
|
||||
@ -61,6 +62,7 @@ void SkGraphics::PurgeAllCaches() {
|
||||
SkGraphics::PurgeFontCache();
|
||||
SkGraphics::PurgeResourceCache();
|
||||
SkImageFilter::PurgeCache();
|
||||
SkLiteDL::PurgeFreelist();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -711,3 +711,12 @@ void SkLiteDL::internal_dispose() const {
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
void SkLiteDL::PurgeFreelist() {
|
||||
SkAutoMutexAcquire lock(gFreeStackLock);
|
||||
while (gFreeStack) {
|
||||
SkLiteDL* top = gFreeStack;
|
||||
gFreeStack = gFreeStack->fNext;
|
||||
delete top; // Calling unref() here would just put it back on the list!
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ class SkLiteDL final : public SkDrawable {
|
||||
public:
|
||||
static sk_sp<SkLiteDL> New(SkRect);
|
||||
|
||||
static void PurgeFreelist();
|
||||
|
||||
void optimizeFor(GrContext*);
|
||||
void makeThreadsafe();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user