Chromium Code Reviews| Index: src/core/SkImageFilter.cpp |
| diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
| index 0a5aca85edd2abf8a98c4f675114565f935afae0..0a5e16e1d7a54d44640a0ff86cc5c343cb4dea42 100644 |
| --- a/src/core/SkImageFilter.cpp |
| +++ b/src/core/SkImageFilter.cpp |
| @@ -474,6 +474,16 @@ public: |
| removeInternal(tail); |
| } |
| } |
| + |
| + void purge() override { |
| + SkAutoMutexAcquire mutex(fMutex); |
| + while (fCurrentBytes > 0) { |
| + Value* tail = fLRU.tail(); |
| + SkASSERT(tail); |
| + this->removeInternal(tail); |
| + } |
| + } |
| + |
| private: |
| void removeInternal(Value* v) { |
| fCurrentBytes -= v->fBitmap.getSize(); |
| @@ -504,3 +514,7 @@ SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); |
| SkImageFilter::Cache* SkImageFilter::Cache::Get() { |
| return cache.get(); |
| } |
| + |
| +void SkImageFilter::PurgeCache() { |
|
robertphillips
2015/05/20 20:28:19
Should this be gCache ?
|
| + cache.get()->purge(); |
| +} |