summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2009-04-27 14:32:05 -0400
committerMike Reed <reed@google.com>2009-04-27 14:32:05 -0400
commitcaf0df1b7f99736aed1a0b923ef278fc4fd0fcca (patch)
tree59d8cc6a5756bb0a637d16768b4a6f41c997bbe2 /core/jni
parentfc8db53eee11568b286e8d9c17e211bd6781fab6 (diff)
downloadframeworks_base-caf0df1b7f99736aed1a0b923ef278fc4fd0fcca.zip
frameworks_base-caf0df1b7f99736aed1a0b923ef278fc4fd0fcca.tar.gz
frameworks_base-caf0df1b7f99736aed1a0b923ef278fc4fd0fcca.tar.bz2
Add call to (new) Canvas.freeCaches() in response to low-memory
This is in conjunction with removing a similar call made by the browser. Now it will be centralized, and the browser's call site will be removed.
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android/graphics/Canvas.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 605e4b8..bd6fea8 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -21,6 +21,8 @@
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkGLCanvas.h"
+#include "SkGraphics.h"
+#include "SkImageRef_GlobalPool.h"
#include "SkShader.h"
#include "SkTemplates.h"
@@ -58,8 +60,11 @@ public:
return new SkGLCanvas;
}
- static void freeGlCaches(JNIEnv* env, jobject) {
+ static void freeCaches(JNIEnv* env, jobject) {
+ // these are called in no particular order
SkGLCanvas::DeleteAllTextures();
+ SkImageRef_GlobalPool::SetRAMUsed(0);
+ SkGraphics::SetFontCacheUsed(0);
}
static jboolean isOpaque(JNIEnv* env, jobject jcanvas) {
@@ -933,7 +938,7 @@ static JNINativeMethod gCanvasMethods[] = {
(void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint},
{"native_drawPicture", "(II)V", (void*) SkCanvasGlue::drawPicture},
- {"freeGlCaches", "()V", (void*) SkCanvasGlue::freeGlCaches}
+ {"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches}
};
#include <android_runtime/AndroidRuntime.h>