Added event to notify plugins when the app is running low on memory.
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index e743acb..8439295 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -2415,6 +2415,14 @@
GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
}
+static void FreeMemory(JNIEnv* env, jobject obj)
+{
+ ANPEvent event;
+ SkANP::InitEvent(&event, kLifecycle_ANPEventType);
+ event.data.lifecycle.action = kFreeMemory_ANPLifecycleAction;
+ GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
+}
+
// ----------------------------------------------------------------------------
/*
@@ -2497,6 +2505,7 @@
(void*) SetDatabaseQuota },
{ "nativePause", "()V", (void*) Pause },
{ "nativeResume", "()V", (void*) Resume },
+ { "nativeFreeMemory", "()V", (void*) FreeMemory },
};
int register_webviewcore(JNIEnv* env)
diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h
index c0eca1a..bda8eeb 100644
--- a/WebKit/android/plugins/android_npapi.h
+++ b/WebKit/android/plugins/android_npapi.h
@@ -281,7 +281,7 @@
/** ANPColor is always defined to have the same packing on all platforms, and
it is always unpremultiplied.
-
+
This is in contrast to 32bit format(s) in bitmaps, which are premultiplied,
and their packing may vary depending on the platform, hence the need for
ANPBitmapInterface::getPixelPacking()
@@ -670,6 +670,7 @@
kResume_ANPLifecycleAction = 1,
kGainFocus_ANPLifecycleAction = 2,
kLooseFocus_ANPLifecycleAction = 3,
+ kFreeMemory_ANPLifecycleAction = 4,
};
typedef uint32_t ANPLifecycleAction;