summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeng Qian <fqian@google.com>2009-06-29 16:08:57 -0700
committerFeng Qian <fqian@google.com>2009-06-29 16:28:44 -0700
commit2ac011692daa197e15a21460f3c8d0e7dec53b0a (patch)
tree4af89cd544cae4b286d92a5498ce1d5f1ecf466b
parent2946187165942a8c8619fdfee44027a09cd4d886 (diff)
downloadexternal_webkit-2ac011692daa197e15a21460f3c8d0e7dec53b0a.zip
external_webkit-2ac011692daa197e15a21460f3c8d0e7dec53b0a.tar.gz
external_webkit-2ac011692daa197e15a21460f3c8d0e7dec53b0a.tar.bz2
Add SetJSFlags option in debug mode.
-rw-r--r--Android.v8.mk2
-rw-r--r--V8Binding/Android.v8shell.mk1
-rw-r--r--WebKit/android/jni/WebViewCore.cpp20
3 files changed, 22 insertions, 1 deletions
diff --git a/Android.v8.mk b/Android.v8.mk
index d0da67d..3edcc36 100644
--- a/Android.v8.mk
+++ b/Android.v8.mk
@@ -209,7 +209,7 @@ LOCAL_SHARED_LIBRARIES += libdl
endif
# Build the list of static libraries
-LOCAL_STATIC_LIBRARIES += libxml2 libv8
+LOCAL_STATIC_LIBRARIES += libv8 libxml2
# Redefine LOCAL_SRC_FILES to be all the WebKit source files
LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES)
diff --git a/V8Binding/Android.v8shell.mk b/V8Binding/Android.v8shell.mk
index 46cf4ee..09a77ef 100644
--- a/V8Binding/Android.v8shell.mk
+++ b/V8Binding/Android.v8shell.mk
@@ -7,6 +7,7 @@ LOCAL_MODULE := v8shell
LOCAL_CPP_EXTENSION := .cc
LOCAL_STATIC_LIBRARIES := libv8
+LOCAL_SHARED_LIBRARIES := libcutils
LOCAL_C_INCLUDES += $(LOCAL_PATH)/v8/include
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 2564da5..a879b6f 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -98,6 +98,11 @@
#include "jni_utility.h"
#include <wtf/CurrentTime.h>
+#if USE(V8)
+#include "CString.h"
+#include "ScriptController.h"
+#endif
+
#if DEBUG_NAV_UI
#include "SkTime.h"
#endif
@@ -2382,6 +2387,20 @@ static void DumpNavTree(JNIEnv *env, jobject obj)
viewImpl->dumpNavTree();
}
+static void SetJsFlags(JNIEnv *env, jobject obj, jstring flags)
+{
+#if USE(V8)
+ // This code is called from UI thread, but it is safe to call setFlags
+ // on ScriptController since it initializes global variables only.
+ // As long as the WebCore thread does not change the default JS flags,
+ // it is safe to call it here.
+ WebCore::String flagsString = to_string(env, flags);
+ WebCore::CString utf8String = flagsString.utf8();
+ WebCore::ScriptController::setFlags(utf8String.data(), utf8String.length());
+#endif
+}
+
+
// Called from the Java side to set a new quota for the origin in response.
// to a notification that the original quota was exceeded.
static void SetDatabaseQuota(JNIEnv* env, jobject obj, jlong quota) {
@@ -2544,6 +2563,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
{ "nativePause", "()V", (void*) Pause },
{ "nativeResume", "()V", (void*) Resume },
{ "nativeFreeMemory", "()V", (void*) FreeMemory },
+ { "nativeSetJsFlags", "(Ljava/lang/String;)V", (void*) SetJsFlags },
};
int register_webviewcore(JNIEnv* env)