summaryrefslogtreecommitdiffstats
path: root/WebCore/bridge
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-06-29 15:55:10 -0400
committerPatrick Scott <phanna@android.com>2010-06-29 16:01:57 -0400
commit9d4701f9dc3d6fec15813f6ff9da0ae2611aa4be (patch)
treedaf31486264c102d8f84b89022b6014a19c8b89c /WebCore/bridge
parent2943c136f14cf8d0631249dd8764a0b6ab45fb98 (diff)
downloadexternal_webkit-9d4701f9dc3d6fec15813f6ff9da0ae2611aa4be.zip
external_webkit-9d4701f9dc3d6fec15813f6ff9da0ae2611aa4be.tar.gz
external_webkit-9d4701f9dc3d6fec15813f6ff9da0ae2611aa4be.tar.bz2
Push a local reference frame to avoid table overflow.
Similar to jsc's implementation, this is needed to restrict the amount of local references in a given jni frame. Once the frame is popped from the stack, all local references are cleaned. Bug: 2807132 Change-Id: I5f4153509c513bec142472927a1787869a57f530
Diffstat (limited to 'WebCore/bridge')
-rw-r--r--WebCore/bridge/jni/v8/JavaInstanceV8.cpp17
-rw-r--r--WebCore/bridge/jni/v8/JavaInstanceV8.h4
2 files changed, 13 insertions, 8 deletions
diff --git a/WebCore/bridge/jni/v8/JavaInstanceV8.cpp b/WebCore/bridge/jni/v8/JavaInstanceV8.cpp
index 3a2cb8b..59aa104 100644
--- a/WebCore/bridge/jni/v8/JavaInstanceV8.cpp
+++ b/WebCore/bridge/jni/v8/JavaInstanceV8.cpp
@@ -32,14 +32,9 @@
#include "JavaClassV8.h"
#include <assert.h>
-#include <utils/Log.h>
#define LOG_TAG "v8binding"
-
-// ANDROID
-#include <cutils/log.h>
-#define LOG_TAG JavaInstanceV8.cpp
-// END ANDROID
+#include <utils/Log.h>
using namespace JSC::Bindings;
@@ -55,6 +50,16 @@ JavaInstance::~JavaInstance()
delete m_class;
}
+#define NUM_LOCAL_REFS 64
+
+void JavaInstance::virtualBegin() {
+ getJNIEnv()->PushLocalFrame(NUM_LOCAL_REFS);
+}
+
+void JavaInstance::virtualEnd() {
+ getJNIEnv()->PopLocalFrame(0);
+}
+
JavaClass* JavaInstance::getClass() const
{
if (!m_class)
diff --git a/WebCore/bridge/jni/v8/JavaInstanceV8.h b/WebCore/bridge/jni/v8/JavaInstanceV8.h
index c928c05..4f009a5 100644
--- a/WebCore/bridge/jni/v8/JavaInstanceV8.h
+++ b/WebCore/bridge/jni/v8/JavaInstanceV8.h
@@ -89,8 +89,8 @@ protected:
RefPtr<JObjectWrapper> m_instance;
mutable JavaClass* m_class;
- virtual void virtualBegin() {}
- virtual void virtualEnd() {}
+ virtual void virtualBegin();
+ virtual void virtualEnd();
};
} // namespace Bindings