diff options
-rw-r--r-- | Android.mk | 37 | ||||
-rw-r--r-- | WebKit/android/jni/WebCoreJni.cpp | 61 | ||||
-rw-r--r-- | WebKit/android/jni/WebCoreJniOnLoad.cpp | 93 | ||||
-rw-r--r-- | perf/Android.mk | 99 | ||||
-rw-r--r-- | perf/main.cpp | 10 |
5 files changed, 153 insertions, 147 deletions
@@ -23,7 +23,7 @@ include $(CLEAR_VARS) # Define our module and find the intermediates directory LOCAL_MODULE := libwebcore -LOCAL_MODULE_CLASS := SHARED_LIBRARIES +LOCAL_MODULE_CLASS := STATIC_LIBRARIES base_intermediates := $(call local-intermediates-dir) # Using := here prevents recursive expansion @@ -94,9 +94,10 @@ LOCAL_PATH := $(BASE_PATH) LOCAL_CFLAGS += -Wno-endif-labels -Wno-import -Wno-format LOCAL_CFLAGS += -fno-strict-aliasing LOCAL_CFLAGS += -include "WebCorePrefixAndroid.h" +LOCAL_CFLAGS += -fvisibility=hidden ifeq ($(TARGET_ARCH),arm) -LOCAL_CFLAGS += -Darm -fvisibility=hidden +LOCAL_CFLAGS += -Darm endif ifeq ($(ENABLE_SVG),true) @@ -136,6 +137,7 @@ LOCAL_C_INCLUDES := \ external/skia/src/ports \ external/sqlite/dist \ frameworks/base/core/jni/android/graphics \ + $(LOCAL_PATH) \ $(LOCAL_PATH)/WebCore \ $(LOCAL_PATH)/WebCore/css \ $(LOCAL_PATH)/WebCore/dom \ @@ -231,7 +233,30 @@ endif # Redefine LOCAL_SRC_FILES to be all the WebKit source files LOCAL_SRC_FILES := $(WEBKIT_SRC_FILES) +# Define this for use in other makefiles. +WEBKIT_C_INCLUDES := $(LOCAL_C_INCLUDES) +WEBKIT_CFLAGS := $(LOCAL_CFLAGS) +WEBKIT_GENERATED_SOURCES := $(LOCAL_GENERATED_SOURCES) +WEBKIT_LDLIBS := $(LOCAL_LDLIBS) +WEBKIT_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES) +WEBKIT_STATIC_LIBRARIES := $(LOCAL_STATIC_LIBRARIES) + # Build the library all at once +include $(BUILD_STATIC_LIBRARY) + +# Now build the shared library using only the exported jni entry point. This +# will strip out any unused code from the entry point. +include $(CLEAR_VARS) +LOCAL_MODULE := libwebcore +LOCAL_LDLIBS := $(WEBKIT_LDLIBS) +LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES) +LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES) +LOCAL_LDFLAGS := -fvisibility=hidden +LOCAL_CFLAGS := $(WEBKIT_CFLAGS) +LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) +LOCAL_PATH := $(BASE_PATH) +LOCAL_SRC_FILES := \ + WebKit/android/jni/WebCoreJniOnLoad.cpp include $(BUILD_SHARED_LIBRARY) # Build the plugin test separately from libwebcore @@ -240,10 +265,10 @@ include $(BASE_PATH)/WebKit/android/plugins/sample/Android.mk # Build the wds client include $(BASE_PATH)/WebKit/android/wds/client/Android.mk -# Build the performance command line tool. -# XXX: Uncomment this include to build webcore_test. In order for the test to -# link with libwebcore, remove -fvisibility=hidden from LOCAL_CFLAGS above -#include $(BASE_PATH)/perf/Android.mk +# Build the performance command line tool but only if v8 is disabled. +#ifneq ($(ENABLE_V8),true) +include $(BASE_PATH)/perf/Android.mk +#endif # Build the webkit merge tool. include $(BASE_PATH)/WebKitTools/android/webkitmerge/Android.mk diff --git a/WebKit/android/jni/WebCoreJni.cpp b/WebKit/android/jni/WebCoreJni.cpp index b3635f5..8e76f2e 100644 --- a/WebKit/android/jni/WebCoreJni.cpp +++ b/WebKit/android/jni/WebCoreJni.cpp @@ -33,16 +33,6 @@ namespace android { -extern int register_webframe(JNIEnv*); -extern int register_javabridge(JNIEnv*); -extern int register_resource_loader(JNIEnv*); -extern int register_webviewcore(JNIEnv*); -extern int register_webhistory(JNIEnv*); -extern int register_webicondatabase(JNIEnv*); -extern int register_websettings(JNIEnv*); -extern int register_webstorage(JNIEnv*); -extern int register_webview(JNIEnv*); - // Class, constructor, and get method on WeakReference jclass gWeakRefClass; jmethodID gWeakRefInit; @@ -94,39 +84,7 @@ WebCore::String to_string(JNIEnv* env, jstring str) return ret; } -} - -struct RegistrationMethod { - const char* name; - int (*func)(JNIEnv*); -}; - -static RegistrationMethod gWebCoreRegMethods[] = { - { "JavaBridge", android::register_javabridge }, - { "WebFrame", android::register_webframe }, - { "WebCoreResourceLoader", android::register_resource_loader }, - { "WebViewCore", android::register_webviewcore }, - { "WebHistory", android::register_webhistory }, - { "WebIconDatabase", android::register_webicondatabase }, - { "WebSettings", android::register_websettings }, - { "WebStorage", android::register_webstorage }, - { "WebView", android::register_webview } -}; - -EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) -{ - // Save the JavaVM pointer for use globally. - JSC::Bindings::setJavaVM(vm); - - JNIEnv* env = NULL; - jint result = -1; - - if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) { - LOGE("GetEnv failed!"); - return result; - } - LOG_ASSERT(env, "Could not retrieve the env!"); - +int register_webcorejni(JNIEnv* env) { // Instantiate the WeakReference fields. android::gWeakRefClass = env->FindClass("java/lang/ref/WeakReference"); LOG_ASSERT(android::gWeakRefClass, "Could not find WeakReference"); @@ -138,20 +96,7 @@ EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) "()Ljava/lang/Object;"); LOG_ASSERT(android::gWeakRefInit, "Could not find get method for WeakReference"); + return JNI_OK; +} - const RegistrationMethod* method = gWebCoreRegMethods; - const RegistrationMethod* end = method + sizeof(gWebCoreRegMethods)/sizeof(RegistrationMethod); - while (method != end) { - if (method->func(env) < 0) { - LOGE("%s registration failed!", method->name); - return result; - } - method++; - } - - // Initialize rand() function. The rand() function is used in - // FileSystemAndroid to create a random temporary filename. - srand(time(NULL)); - - return JNI_VERSION_1_4; } diff --git a/WebKit/android/jni/WebCoreJniOnLoad.cpp b/WebKit/android/jni/WebCoreJniOnLoad.cpp new file mode 100644 index 0000000..f3f6efa --- /dev/null +++ b/WebKit/android/jni/WebCoreJniOnLoad.cpp @@ -0,0 +1,93 @@ +/* + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#define LOG_TAG "webcoreglue" + +#include "jni_utility.h" +#include <jni.h> +#include <utils/Log.h> + +namespace android { + +extern int register_webframe(JNIEnv*); +extern int register_javabridge(JNIEnv*); +extern int register_resource_loader(JNIEnv*); +extern int register_webviewcore(JNIEnv*); +extern int register_webhistory(JNIEnv*); +extern int register_webicondatabase(JNIEnv*); +extern int register_websettings(JNIEnv*); +extern int register_webstorage(JNIEnv*); +extern int register_webview(JNIEnv*); +extern int register_webcorejni(JNIEnv*); + +} + +struct RegistrationMethod { + const char* name; + int (*func)(JNIEnv*); +}; + +static RegistrationMethod gWebCoreRegMethods[] = { + { "JavaBridge", android::register_javabridge }, + { "WebFrame", android::register_webframe }, + { "WebCoreResourceLoader", android::register_resource_loader }, + { "WebCoreJni", android::register_webcorejni }, + { "WebViewCore", android::register_webviewcore }, + { "WebHistory", android::register_webhistory }, + { "WebIconDatabase", android::register_webicondatabase }, + { "WebSettings", android::register_websettings }, + { "WebStorage", android::register_webstorage }, + { "WebView", android::register_webview } +}; + +EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) +{ + // Save the JavaVM pointer for use globally. + JSC::Bindings::setJavaVM(vm); + + JNIEnv* env = NULL; + jint result = -1; + + if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) { + LOGE("GetEnv failed!"); + return result; + } + LOG_ASSERT(env, "Could not retrieve the env!"); + + const RegistrationMethod* method = gWebCoreRegMethods; + const RegistrationMethod* end = method + sizeof(gWebCoreRegMethods)/sizeof(RegistrationMethod); + while (method != end) { + if (method->func(env) < 0) { + LOGE("%s registration failed!", method->name); + return result; + } + method++; + } + + // Initialize rand() function. The rand() function is used in + // FileSystemAndroid to create a random temporary filename. + srand(time(NULL)); + + return JNI_VERSION_1_4; +} diff --git a/perf/Android.mk b/perf/Android.mk index 2d7bd92..59aa177 100644 --- a/perf/Android.mk +++ b/perf/Android.mk @@ -32,87 +32,24 @@ LOCAL_SRC_FILES := \ MyJavaVM.cpp \ main.cpp -WEBCORE := external/webkit/WebCore -WEBKIT := external/webkit/WebKit -JSC := external/webkit/JavaScriptCore - -LOCAL_CFLAGS += -include "WebCorePrefixAndroid.h" - -LOCAL_C_INCLUDES := \ - $(JNI_H_INCLUDE) \ - external/webkit \ - external/icu4c/common \ - external/libxml2/include \ - external/skia/include/effects \ - external/skia/include/images \ - external/skia/include/ports \ - external/skia/include/utils \ - external/skia/src/ports \ - external/sqlite/dist \ - $(WEBKIT) \ - $(WEBKIT)/android/stl \ - $(WEBCORE) \ - $(WEBCORE)/bindings/js \ - $(WEBCORE)/bridge \ - $(WEBCORE)/bridge/c \ - $(WEBCORE)/bridge/jni \ - $(WEBCORE)/css \ - $(WEBCORE)/dom \ - $(WEBCORE)/editing \ - $(WEBCORE)/history \ - $(WEBCORE)/html \ - $(WEBCORE)/inspector \ - $(WEBCORE)/loader \ - $(WEBCORE)/loader/appcache \ - $(WEBCORE)/loader/icon \ - $(WEBCORE)/page \ - $(WEBCORE)/page/android \ - $(WEBCORE)/page/animation \ - $(WEBCORE)/platform \ - $(WEBCORE)/platform/android \ - $(WEBCORE)/platform/animation \ - $(WEBCORE)/platform/graphics \ - $(WEBCORE)/platform/graphics/android \ - $(WEBCORE)/platform/graphics/network \ - $(WEBCORE)/platform/graphics/transforms \ - $(WEBCORE)/platform/image-decoders \ - $(WEBCORE)/platform/network \ - $(WEBCORE)/platform/network/android \ - $(WEBCORE)/platform/sql \ - $(WEBCORE)/platform/text \ - $(WEBCORE)/plugins \ - $(WEBCORE)/rendering \ - $(WEBCORE)/rendering/style \ - $(WEBCORE)/storage \ - $(WEBCORE)/xml \ - $(WEBKIT)/android \ - $(WEBKIT)/android/jni \ - $(WEBKIT)/android/nav \ - $(WEBKIT)/android/plugins \ - $(WEBKIT)/android/WebCoreSupport \ - $(JSC) \ - $(JSC)/API \ - $(JSC)/assembler \ - $(JSC)/bytecode \ - $(JSC)/bytecompiler \ - $(JSC)/debugger \ - $(JSC)/parser \ - $(JSC)/jit \ - $(JSC)/interpreter \ - $(JSC)/pcre \ - $(JSC)/profiler \ - $(JSC)/runtime \ - $(JSC)/wrec \ - $(JSC)/wtf \ - $(JSC)/wtf/unicode \ - $(JSC)/wtf/unicode/icu \ - $(JSC)/ForwardingHeaders \ - $(base_intermediates)/WebCore/page \ - $(call include-path-for, corecg graphics) - -LOCAL_SHARED_LIBRARIES := libwebcore - -LOCAL_MODULE:= webcore_test +# Pull the webkit definitions from the base webkit makefile. +LOCAL_STATIC_LIBRARIES := libwebcore $(WEBKIT_STATIC_LIBRARIES) +LOCAL_SHARED_LIBRARIES := $(WEBKIT_SHARED_LIBRARIES) +LOCAL_LDLIBS := $(WEBKIT_LDLIBS) +LOCAL_C_INCLUDES := $(WEBKIT_C_INCLUDES) +LOCAL_CFLAGS := $(WEBKIT_CFLAGS) + +LOCAL_MODULE := webcore_test + +# Do this dependency by hand. The reason we have to do this is because the +# headers that this program pulls in are generated during the build of webcore. +# We make all of our object files depend on those files so that they are built +# before we try to compile our sources. +LOCAL_MODULE_CLASS := EXECUTABLES +intermediates := $(call local-intermediates-dir) +$(intermediates)/%.o : $(WEBKIT_GENERATED_SOURCES) + +LOCAL_MODULE_TAGS := tests include $(BUILD_EXECUTABLE) diff --git a/perf/main.cpp b/perf/main.cpp index 9314e42..927f55e 100644 --- a/perf/main.cpp +++ b/perf/main.cpp @@ -39,7 +39,11 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "HistoryItem.h" +#if USE(JSC) #include "InitializeThreading.h" +#elif USE(V8) +#include "V8InitializeThreading.h" +#endif #include "InspectorClientAndroid.h" #include "Intercept.h" #include "IntRect.h" @@ -117,8 +121,11 @@ int main(int argc, char** argv) { LOGE("Please supply a file to read\n"); return 1; } - +#if USE(JSC) JSC::initializeThreading(); +#elif USE(V8) + V8::initializeThreading(); +#endif // Setting this allows data: urls to load from a local file. FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForAll); @@ -169,7 +176,6 @@ int main(int argc, char** argv) { // assertion in the Cache code) frame->init(); frame->selection()->setFocused(true); - frame->loader()->setUseLowBandwidthDisplay(false); // Set all the default settings the Browser normally uses. Settings* s = frame->settings(); |