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:
mtklein 2016-08-09 07:40:23 -07:00 committed by Commit bot
parent 8369e32a05
commit 0c753e5c26
3 changed files with 13 additions and 0 deletions

View File

@ -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();
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -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!
}
}

View File

@ -21,6 +21,8 @@ class SkLiteDL final : public SkDrawable {
public:
static sk_sp<SkLiteDL> New(SkRect);
static void PurgeFreelist();
void optimizeFor(GrContext*);
void makeThreadsafe();