From 7e2b0f3b06351cf5bd9f6130f6bfb950cfc2cb75 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 28 May 2014 18:51:03 +0000 Subject: [PATCH] Add SkPurgeGlobalDiscardableMemoryPool, needed to replace SkImageRef BUG=skia:2389 R=reed@google.com, scroggo@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/298423002 git-svn-id: http://skia.googlecode.com/svn/trunk@14925 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkImageGenerator.h | 6 ++++++ src/lazy/SkDiscardableMemoryPool.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h index f399ab5..76e856b 100644 --- a/include/core/SkImageGenerator.h +++ b/include/core/SkImageGenerator.h @@ -34,6 +34,12 @@ class SkImageGenerator; */ SK_API bool SkInstallDiscardablePixelRef(SkImageGenerator*, SkBitmap* destination); +/** + * Purges all unlocked discardable memory in Skia's global + * discardable memory pool. + */ +SK_API void SkPurgeGlobalDiscardableMemoryPool(); + /** * An interface that allows a purgeable PixelRef (such as a diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp index 9612169..4fb8ae4 100644 --- a/src/lazy/SkDiscardableMemoryPool.cpp +++ b/src/lazy/SkDiscardableMemoryPool.cpp @@ -271,4 +271,8 @@ SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() { return gPool; } +// defined in SkImageGenerator.h +void SkPurgeGlobalDiscardableMemoryPool() { + SkGetGlobalDiscardableMemoryPool()->dumpPool(); +} //////////////////////////////////////////////////////////////////////////////// -- 2.7.4